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

help with back button

Status
Not open for further replies.

GUJUm0deL

Programmer
Jan 16, 2001
3,676
US
Hiya everyone, I have a problem:
If you go here: and select something for the following choices (Select 'Office Supplies' 'Paper' 'Computer Paper') and then hit the submit button...
After you hit that button, the choices you selected you will see on the action page, now this is where my problem happens, if you hit the browser back button, you will see that ONLY the value for CHOICE1 is shown, but the values for CHOICE2 and CHOICE3 are back to Choose One...
Why?? I know this has something to do with the JavaScript, but can't figure out what. I've been looking at it for over a week now, and it gives me a headache...
Thanks... I have not failed; I have merely found 100,000 different ways of not succeding...
 
I tried your form and I noticed that when I select from the second drop down box and select nothing in the first or third, everything is preserved when hit the back button. Same thing if I select from boxes 2 and 3. Only when 1 is filled in are 2 and 3 changed when hit the back button...Hope this helps!
 
snix1, but if you don't select anything from the first drop-down, there's nothing to select in the second or the third drop-down... I have not failed; I have merely found 100,000 different ways of not succeding...
 
hi remember i did the same kind of coding as urs
its becos the values are in javascript
and when u hit back only the first will be retain
i have the same problem as well
 
So did you solve the problem?? How did you overcome it?? I have not failed; I have merely found 100,000 different ways of not succeding...
 
well... i didnt
lucky only the adminstrator have the right to edit the page after submitting and i have validate it to alert me if its empty....
 
I'm always fielding questions at work about the Back button. The tough thing is, the behavior of the back button is not well-defined. In some cases, it restores the previous page in the state that it was when it first loaded (like what's happening here); in other cases, it restores the page in its most recent state (often the case with normal form choices).

My suggestion is to put calls in the <BODY>'s onload handler to all the functions that set up your select boxes. You may have to tweak the functions a little to deal with being called when the page first loads, but these changes should be minor or possibly even not necessary. That way, when the page loads again (after clicking the back button), the user doesn't have to change the select box to trigger the function again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top