|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
server side validation - back button loses values
Hi
I am using javascript and server side validation. This is a scenario for if someone has javascript turned off and the server side validation comes into play. I have a form which submits to a hidden page which retrieves the data and the submits it to a db. When the data is posted, I am doing server validation checks before submitting to the db ie. if str = "" or str = "" then print this page saying 'please complete all fields'. Now the user has to user their back browser button to get back to the form. The problem is that sometimes the values they entered into the form are there and sometimes they aren't. How can I ensure that the values they entered are still in the form? Really appreciate this. Cheers Lee |
|
#2
|
||||
|
||||
|
I believe that things like Password fields are automatically setup to be lost, but the whole problem here is that you're using a stateless connection (like many setups are)
HTML is by default stateless, meaning that when you return to the page with the BACK button, you're merely re-making a GET request to that page, and that's why information does not exist there. What you may want to do is that upon submit, set invisible form fields to the values entered on the processing page, and if errors occur, set those values to session variables or submit that page back to the input page and use Request.Form to populate the fields again. |
|
#3
|
|||
|
|||
|
Thanks for your advice, Aaron! What a mission. I had to set hidden fields and then post back to the form.
Cheers Lee |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > server side validation - back button loses values |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|