function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ken KoellnerKen Koellner 

Prevent re-submit after Browser Back in VF Sites wizard

I have a series of VF pages using the same controller that functions as a wizard on Sites.

User goes NEXT->NEXT->NEXT->SUBMIT.

 

The SUBMIT button saves information and puts up a display-only confirmation page.

 

After the user submits, I save information.  I want to preven the user from using the "Back" button and then resubmitting the same information.  I have the submit action method set a flag to true on submit.  Before it runs, it checks that flag to see if it is true and is supposed to set an error and redirect the user if it is.  But that test is not working.

 

When I'm on a confirmation page after the user does the submit, I hit back in the browser and get the warning "To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier." and say okay.  I then press the Submit button again and it still saves the information again.

 

The only thing I can think of is that when it loads the page before the confirmation, it backs up the memory of the controller to the state it was in before the submit.

 

Anyone have and idea how to do the check?

 

I supposed I could create some session id and save it to the database but I'd rather not have to do that.

 

I have cache="false" on all pages.

 

 

sfdcfoxsfdcfox

Use AJAX (rerender, for example). Pure VF has this problem for the same reason ASP does... View state is stored in a hidden form element. Using AJAX will reduce this problem on platforms where JS is available.

nwbienwbie

Hi sfdcfox

     What do you suggest for this scenario?  Do you suggest one single visualforce page that rerenders different sections based on the action performed?

 

     Or is it good to enable multiple page content dynamically?  Any suggestions to achieve Idempotence in force.com public site.

 

Cheers

Newbie

 

Ken KoellnerKen Koellner

I put "cache="false" in the apex:page tag of the page before submit.  Now when I hit the back key, I get a page expired message.  I think that might be a viable solution.  I haven't beat it death yet as we are only releasing the site internal right now so it's effectively in beta mode.

 

 

nwbienwbie
Did you try refreshing the page after the session expired warning?
After the page is refreshed, again you will be able to see that the view state is constructed.
Thanks in Advance
Salesforce_DevelopmentSalesforce_Development

Ken,

 

Did you get it work ? , i mean disabling the browser back button....

 

Thanks