...

View Full Version : Radio select problem



florida
04-10-2003, 06:16 PM
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>>

beetle
04-10-2003, 06:23 PM
That "sticking radio-button" is only because it's value is 0. The JS to fix that is
<script type="text/javascript">

function doit( rb )
{
if ( rb.checked )
rb.checked = !rb.checked;
}

</script>

</head>
<body onload="doit( document.forms[0].approved[1] )">

florida
04-10-2003, 06:44 PM
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?

beetle
04-10-2003, 06:53 PM
Oog, now you're talking about getting cookies involved.

Is this worth it?

florida
04-10-2003, 08:47 PM
If its too complicated then no it would not be worth it. Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum