View Full Version : Radio select problem

04-10-2003, 07: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.

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

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

04-10-2003, 07: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;


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

04-10-2003, 07: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?

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

Is this worth it?

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