I don't use cfform but something like this would work...
<script language="javascript">
function chk()
{
var cont = false;
radio = document.getElementsByName("age_id");
for(var i = 0; i < radio.length; i++) {
if (radio[i].checked == true) {
cont = true;
break;
}
}
if (cont == false) {
// notify user
alert("nada was checked");
}
return cont;
}
</script>
<form name="foo" action="frm.cfm" method="post" onsubmit="return chk();">
age : <br />
<input type="radio" name="age_id" value="1"> 18-25<br />
<input type="radio" name="age_id" value="2"> 26-33<br />
<input type="radio" name="age_id" value="3"> 33-40<br />
<input type="radio" name="age_id" value="0"> other<br />
<input type="submit">
</form>
but being javascript I'd check server side too...
>
> -----Original Message-----
> From: Melissa Cope [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2008 12:09 PM
> To: CF-Newbie
> Subject: Requiring radio button selection
>
> I'm putting together a form where there is a yes/no question that the
> user is required to answer. Neither button can be pre-checked because we
> want to keep the user from glossing over the question and going with the
> default option.
>
> Surprisingly, I have had trouble finding out how to deal with this. Do
> we put "required=yes" and the "message" in both the yes button and no
> button <cfinput> tags?
>
> Thanks!
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3942
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15