PDA

View Full Version : Keeping values in form entered


blueskies
Aug 9th, 2007, 11:13 AM
If I create a regular plain HTML Form (no Spring) , enter some values, hit submit, then hit the back button because I need to change something, the value I entered is still there.

However, in a Spring MVC Form Controller, if I hit submit, hit the back button, the form is empty.

How can I get it to retain the values?

Jörg Heinicke
Aug 10th, 2007, 12:08 AM
I guess this depends on whether the form is reloaded or not. Try to find out if the back button triggers a new server request.

Joerg

blueskies
Aug 13th, 2007, 10:27 AM
I guess this depends on whether the form is reloaded or not. Try to find out if the back button triggers a new server request.

Joerg

It doesn't appear to be. I hit the back button and it goes back to the form but the form is just blank. I want it to include the user input in case they have to use the back button to go back and change something.

mjdalangin
Aug 13th, 2007, 09:44 PM
Maybe it would be better to save your entries to session.That way if the back button was pressed you can display them again.But dont forget to remove them on your session when your thru with them.

blueskies
Aug 15th, 2007, 01:47 PM
Maybe it would be better to save your entries to session.That way if the back button was pressed you can display them again.But dont forget to remove them on your session when your thru with them.


I have an issue in this situation:
1) User enters form incorrectly
2) Form redisplayed with error message
3) User enters form correctly
4) User Hits submit and results displayed
5) User hits back button but popuup comes up saying Post data expired with "Ok" or "cancel"
6) User hits OK, goes back to form but form only contains the data from #1 (incorrect entry) not the valid entry from #3.