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
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Radio select problem

    I have an update form that comes up with an "Approved" and "Disapproved" radio selection.
    It works but I dont like how it automatically checks the "Disapproved" button when the form comes up for the first time. I was hoping the form would come up with "Approved" and "Disapproved" not selected so it allows me to make a selection of one of the two selections. Please advise how I can correct this using Javascript instead of Cold Fusion because I cant get it to work.



    APPROVED
    <INPUT TYPE="radio" NAME="approved" VALUE="1" <CFIF #myquery.approved# Is 1>CHECKED</CFIF>>

    DISAPPROVED
    <INPUT TYPE="radio" NAME="approved" VALUE="0" <CFIF #myquery.approved# Is 0>CHECKED</CFIF>>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That "sticking radio-button" is only because it's value is 0. The JS to fix that is
    Code:
    <script type="text/javascript">
    
    function doit( rb )
    {
        if ( rb.checked )
            rb.checked = !rb.checked;
    }
    
    </script>
    
    </head>
    <body onload="doit( document.forms[0].approved[1] )">
    Last edited by beetle; 04-10-2003 at 06:26 PM.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks it works in now that it comes up with both unchecked and when I check the Approved it works great. But when I check the Disapproved it doesnt save it and next time I go to that page it shows an empty Disapproved. I was wondering how I can get the Disapproved to stay checked?

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Oog, now you're talking about getting cookies involved.

    Is this worth it?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    Regular Coder
    Join Date
    Jul 2002
    Posts
    362
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If its too complicated then no it would not be worth it. Thanks


  •  

    Posting Permissions

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