Aleks
asked on
Select one javascript for radio buttons
I have the javascript below to make sure a user checks at least one checkbox.
Seems to work fine for checkboxes but not for radio buttons. I need help tweaking it so that it works.
I have a repeated region displaying names, they all have ids, I need the user to select one of the radio buttons.
A
Seems to work fine for checkboxes but not for radio buttons. I need help tweaking it so that it works.
I have a repeated region displaying names, they all have ids, I need the user to select one of the radio buttons.
<script language="JavaScript">
function oneCheckboxChecked(form){
for(f=0;f<form.length;f++){
if(form[f].type !="checkbox") continue;
if(form[f].checked){
return true;
}
}
alert("Select at least one User");{
return false;
}
}
</script>
A
ASKER
Can I apply it to onsubmit for the form instead ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window