Search code examples
javascriptinternet-explorerformsback

How do I keep form data when Back button is clicked


I am developing a rails app. (I don't think this is a rails-specific problem) There's a reservation process which is consisted of 3 steps. When a user is on step 2 page, if the user clicks 'Previous' button, the form data in step 1 should be the same as before.

I attached "history.go(-1);" to the 'Previous' button.

It works on my firefox browser. But it doesn't work on some IE browsers. My IE works though.

How can I force it to preserve the form data when the page is back?

Thanks.

Sam


Solution

  • Can't rely on the client (javascript) for this kind of operation.

    You save the data somewhere at step 1, so just restore it.