PDA

View Full Version : checkbox problems



mrboyer79
Feb 15th, 2007, 04:44 PM
hello all,
i'm working on a page where there's a checkbox . when the user checks this box, some text forms and radio buttons appear. when the user un-checks the box, they disappear again. the user, once finished with the page, clicks submit to get to the next page. the issue we are finding is that if the user clicks "back" in the browser, the checkbox remains checked, but the fields are hidden. if the user un-checks the box, the fields reappear. this is obviously backwards. fortunately, the data is still there. what we want to happen is that on going "back", the checkbox would remain checked and the fields underneath would still be displayed. any thoughts???

thanks!

nikkiH
Feb 15th, 2007, 08:09 PM
A script that runs onLoad of body to check if that box is checked.

mrboyer79
Feb 15th, 2007, 08:25 PM
A script that runs onLoad of body to check if that box is checked.

i'm sorry, can you elaborate? if you need more information from me let me know.

thanks!

nikkiH
Feb 15th, 2007, 09:00 PM
You have some function that is run when the user clicks the box, right?
Say onclick="myfunction()" or whatever.
Just call the same function onload so that the code that does whatever hiding/showing needs done will check on the page load.

<body onload="myfunction()">

Then when the user hits the back button, the script will run, see the checked box, and unhide your divs and whatnot. :)

mrboyer79
Feb 15th, 2007, 11:37 PM
thanks! that makes sense! :thumbsup: