hi all,
i have radio buttons for every group on my PHP page which populate dynamically from the DB:
Yes<INPUT TYPE="radio" NAME="rollback_<?=$arr['Audit_ID']?>" id="RollBackRadio[]" value="1"><br>
No<INPUT TYPE="radio" NAME="rollback_<?=$arr['Audit_ID']?>" id="RollBackRadio[]" value="0">
<script language="javascript">
function checkRadio(){
var radios = document.mainform.elements["RollBackRadio[]"];
var radflag=false;
for (var i=0; i<radios.length; i++){
if (radios[i].checked){
radflag=true;
} else {
radflag=false;
}
}
return radflag;
}
</script>
for eg ... if there are three audits on the page then there would be three sets of radio buttons. how do i validate that atleast one radio is checked for every Audit
Note : i cannot change the name of the radio button. probably would have to play with IDs. i tried giving id to the radio but the script is getting length as 6 [for the above case where audits are 3] instead of 3 ..
how can i do it??
Thanks in advance.