PDA

View Full Version : history.go(-1)


heko
09-05-2002, 10:29 AM
Hi,

I need some help with a form. I'm new to jsp but not to java.

In the form the user click on a browser button to choose a file to upload, fills in two text fields that are validated and clicks ok. The problem is if one of the text fields are incorrect, the user gets a pop up window with the error message and clicks ok. Then history.go(-1) is activated but only the text fields have the filled in values not the file field. I want all the filled in values to remain.

Please help!

Thanks!!!
//heko

rsci
09-05-2002, 12:27 PM
One way, a long way, to solve that might be to put the filename into a cookie. Check for the cookie when the page loads, save the cookie when the form is submitted.

heko
09-05-2002, 12:31 PM
Thanks for your answer!

Yes, it does seem like a long way... Do you know if there is any specific reason why the path to the file is cleared when using history.go(-1)? I have also tried history.back() but got the same result.

Thanks!
//heko

heko
09-05-2002, 12:44 PM
Thanks for your answer!

Yes, it does seem like a long way... Do you know if there is any specific reason why the path to the file is cleared when using history.go(-1)? I have also tried history.back() but got the same result.

Thanks!
//heko

duniyadnd
09-05-2002, 08:40 PM
Can't think of a way using javascript for this, but what you could do is use php and create a variable for each one. Everytime you press on submit, it saves the values into those variables, and if you go back, you can label the input values as the variables.

Duniyadnd

adios
09-05-2002, 11:30 PM
If you validated the entries client-side, you could avoid submitting an invalid form at all - making it unnecessary to reload the submitting page. Just a thought.

Netscape, btw, keeps the fields' data persistent. Never been able to figure out why.