how often does the letter "l" occur in:
q: visualforce/apex webpage action is triggered by refreshing the webpage? i have a visualforce page that is live,
the page has one submit button,
but every time the user refreshes the webpage the site action button is activated,
that is when you refresh the webpage it is equivalent to pushing the submit button,
how do i prevent this from happening?
here is the visualforce code:
<apex:page controller="query" standardstylesheets="false" showheader="false" sidebar="false">
<apex:sectionheader title="please enter user information"/>
<apex:pagemessages /> 
<apex:form enctype="multipart/form-data">
   <apex:pageblock >
      <apex:facet name="footer">
      <apex:outputpanel >
         <apex:commandbutton action="{!action}" value="check and uplod" styleclass="btn"/>
      </apex:outputpanel>
      </apex:facet>
   <apex:pageblocksection title="user information">
      <apex:panelgrid columns="2">
         <apex:outputlabel value="first name" for="inqueryfirstname"/>
         <apex:inputfield id="inqueryfirstname" value="{!findot.first_name__c}" required="true"/>
         <apex:outputlabel value="last name" for="inquerylastname"/>
         <apex:inputfield id="inquerylastname" value="{!findot.last_name__c}"  required="true"/>
         <apex:outputlabel value="email" for="inqueryemail"/>
         <apex:inputfield id="inqueryemail" value="{!findot.email__c}"  required="true"/>
      </apex:panelgrid>
   </apex:pageblocksection>
   <apex:pageblocksection title="upload file">
      <apex:panelgrid columns="2">
         <apex:outputlabel for="file"/>
         <apex:inputfile value="{!filereq}" filename="{!namef}" id="file"/>
      </apex:panelgrid>
   </apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>


a: when using visualforce, every action performed on the page causes the page's form to be submitted. if the user presses the browser's refresh button after a submission, they will be in a "previously submitted form" mode, which will cause the information to be posted again using the data from the prior execution. this feature is why many sites advise you not to click refresh after submitting an order because it could double the order. the solution is to clear the form state by explicitly navigating to a new instance of the page (done by returning a pagereference with setredirect to true).
edit
suggested code modification...
public class controller {
    public controller() {
        if(apexpages.currentpage().getparameters().get('m') != null) {
            // display some sort of message about the prior post
        }
    }
    public pagereference action() {
        // do whatever i'm doing here
        pagereference mypage = page.somepage;
        mypage.setredirect(true);
        mypage.getparameters().put('m','ok');
        return mypage;
    }
}


user
The total number of "l"s in that passage is 91.
assistant