lose data in the form when clicking the back button on any browser (Django)
My current ap开发者_如何学JAVAplication has a form which the user fills and hits the submit button to get the output data. But, I loose all the data which was entered into the form when I click the back button on the browser. All the drop down select list get reset to initial setting.
Is there a way where I can store these inputted values and populate it back when the user hits the back button. I want to avoid the user from entering the values into the from again and again..
Thanks
One way of doing it is to use the Javascript beforeunload event, which occurs when you navigate away from a page, then to store the data in a cookie. When the user comes back, you could check for the cookie's existance and content, and repopulate the fields with that data.
This is my first reply on StackOverflow, so I hope it was helpful! :)
精彩评论