Below is the javascript function which can be used to validate a Radiogroup
function chkRadio(thisform,radioGrp) {
myOption = -1;
for (i=thisform.radioGrp.length-1; i > -1; i--) {
if (thisform.radioGrp[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("You must select a radio button");
return false;
}
}
function chkRadio(thisform,radioGrp) {
myOption = -1;
for (i=thisform.radioGrp.length-1; i > -1; i--) {
if (thisform.radioGrp[i].checked) {
myOption = i; i = -1;
}
}
if (myOption == -1) {
alert("You must select a radio button");
return false;
}
}
No comments:
Post a Comment