Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript for form to retain details when back buttoning

Status
Not open for further replies.

mattys

Programmer
May 1, 2001
35
GB
Hi

I have a html form here on an ASP page.

If you fill the form in, hit submit, then have to hit the back button to ammend the form, say, to use a different usename, or password, previously input details have dissapeared. Obviously this is a right pain.

Does anyone know of a bit of Javascript to stop this happening, so details are kept on the form, except where the details have to be ammended, for example, as above.

Help apprciated.

Matt
 
I dont think Javascript can help. It works within the current page. Every request for a new page starts afresh. Submit and Back are requests for new pages. Not new to the person maybe, but new to the browser.

So you have to catch the form data when the form is submitted the first time. You must keep this data in session variables. And you must keep track of the fact that the form has been submitted. I dont know that you can keep track of whether the form has been requested by clicking the Back button specifically. But you can arrange the process in user.asp to assume that a subsequent request results in displaying the form with the fields filled with the data in the session variables.
 
Thanks

I appreciate your help.

I am quite suprised by this as many sites I have used seem to be able to retain form info even after pressing the back button, and I feel that they haven't gone to the lengths you described.

Anyway, I have absoloutely no idea how I would go about doing what you described, so if you could offer up any code, that would be unreal.

Thanks again.

Matt
 
i believe it has something to do with browser cacheing. i know in php there is a single line of code that you can put on the top of your php page to enable this.

possibly, something similar exists in asp.

javascript is not the ideal solution.

*cLFlaVA
----------------------------
[tt]a frickin' twelve-gauge, what do you think?[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Thanks you lot!

checking in asp forum right now.

matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top