views:

249

answers:

3

I went to test my page on another browser. On google chrome i can fill out a form, hit back and forward and still have the data there. Now i need to refresh the page so certain data is correct (such as session id if the cookie expires or user logs out before submitting). I refresh and lose all data. Is there some option i can set so all data is kept?

+1  A: 

You would have to send the values to the server while they are typed in, and then repopulate the form fields on refresh.

Lars Mæhlum
+1  A: 

What framework are you using? For example, ASP.Net WebForms would handle this via ViewState (yuck), ASP.Net MVC would require you to do this manually etc.

You essentially need to persist your data somewhere while the page reloads, and then re-populate the controls.

Jamie
+1  A: 

Yes, the only secure way to do this is to use a serverside script to store the form temporarly. Since browsers handles back/forward diffrently your page won't be x-browser compatible if you don't use the server. If the user hits the back button you are kind of lost already since no post is done, unless you post the form with some javascript magic before the new page is refreshed.

PHP_Jedi