Click to See Complete Forum and Search --> : validate radio btn when respective chk box clicked


shanuragu
09-02-2003, 06:59 AM
I have a set of check boxes. Each check box is associsted with another set of radio buttons. First validation for the check boxes will be done (select at least one chk box) which is working fine. How can I validate the radio buttons for a perticular check box.

here is the sample code as how radio buttons & check boxes are related.

<input type="checkbox" name="service_id" checked id="service_id_<%=rsServices("service_id")%>" tabindex="12" value="<%=rsServices("service_id")%>" onclick="toggleServices(<%=rsServices("service_id")%>)"><%=rsServices("service_nm")%></font>

<input type="radio" id="cos_id_<%=rsCoS("service_id")%>" name="cos_id_<%=rsCoS("service_id")%>" tabindex="13" value="<%=rsCoS("cos_id")%>"><%=rsCoS("cos_nm")%></font>

value of service_id will be same for both chk box and radio button.



Please help

shara

shanuragu
09-02-2003, 07:45 AM
Am able to validate radio buttons by using the following code. But the next filed (list box) validation which was working fine before implementing the radio button validation is not working now. That means there is some error in radio button validation. Can any one help me in this regard.
here is the code for radio button validation

if (numChecked("service_id")>0)
{
for (var i=0;i<form.elements.length;i++)
{
if (form.elements[i].type == "radio")
{
if (form.elements[i].checked)
{
return true;
exit;
}
}
}
alert("Select any Class of Service");
return false;
}

shanuragu
09-02-2003, 07:46 AM
I am able to validate radio buttons by using the following code. But the next filed (list box) validation which was working fine before implementing the radio button validation is not working now. That means there is some error in radio button validation. Can any one help me in this regard.
here is the code for radio button validation

if (numChecked("service_id")>0)
{
for (var i=0;i<form.elements.length;i++)
{
if (form.elements[i].type == "radio")
{
if (form.elements[i].checked)
{
return true;
exit;
}
}
}
alert("Select any Class of Service");
return false;
}

//next field validation is as follows

if (document.form.role_id.selectedIndex<=0)
{
alert("Select User Type");
document.form.role_id.focus();
return false;
}

shara:confused: