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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

history.back()

Status
Not open for further replies.

g2000

Programmer
Aug 31, 2005
39
US
Is that possible to detect if a page goes back(history.back()) using javascript?

 
What exactly are you trying to do? Are you trying to prevent someone going back to avoid accidental submission of the same form twice? ...or... what?

--Dave
 
I have 2 pages, input.asp & error.asp

input.asp has 3 textboxes. When this page is first loaded, all textboxes are disabled. They have to enable (press a button) and edit before submit.

On top of input.asp, error checking is done. If error(s) is/are found, the page is redirect
response.redirect("error.asp").

A back button is in error.asp. So user can go back. The good thing about the back(history.back() ) is that it retains old values. I mean those erroneous input. But the textbox are still disabled.

How to enable those?.. I mean how to distinguish between page when it is first loaded and page that is (go back) from error.asp?
 
Do you need form elements on the input.asp page to be filled in with the values previously entered?

I am trying all sorts of tests and can't figure out anything right now.

My instinct, then, is to make your 'back' button on the error.asp page call a function which actually goes forward, calling input.asp with a URL parameter (e.g., document.location = 'input.asp?dis=F';), catch that in the input.asp page and use the BODY tag's onload event to UNDISABLE certain form elements if the URL parameter value was F.

Anyone else?

--Dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top