Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    checkbox problems

    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!

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    A script that runs onLoad of body to check if that box is checked.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by nikkiH View Post
    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!

  • #4
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    Thanked 32 Times in 31 Posts
    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.

    If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
    Bored? Visit
    http://www.kaelisspace.com/

  • #5
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks! that makes sense!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •