Jump to content

[SOLVED] How do i stop the "resend information" dialog when I submit a search form?


poleposters

Recommended Posts

Hi,

 

I have a search form. Once I submit a query and open a search result, if I click the browser back button. An alert pops up telling me

To display this page, the application must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.

 

This is pretty useful to stop record duplication if I'm submitting a form that inserts data into my database. But my users will find it pretty irritating.

 

Is there any way to stop this? Or is it possible something in my script forces this to occur(I'll be happy to post some code, but its a pretty general search form)

There is a way using post as well.

 

You must submit to an intermediate page that saves any post/get/files data in a session and then this intermediate page redirects to the actual form processing page. By doing this, the back button skips over the intermediate page and goes back to the form page. Since you never go back to the intermediate page, which was the target of the action="..." parameter of the form, the browser does not attempt to resubmit the form data.

 

If you use this method and you make your form and form processing code on the same page, the back button will actually take you to the page you were on before you got to the form. This could take you off the site. To solve this, add a dummy GET parameter to the end of the URL when the intermediate page redirects to the actual form processing code. By doing this the URL of the form and the URL of the form processing page is different (even if it is the same page) and the back button will take you back to the form and not to the page you were on before you first got to the form.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.