Click to See Complete Forum and Search --> : validate form - radio with select list


kierenj
08-08-2003, 05:45 PM
I want to validate a form where the following rule should apply:

There are two radio buttons (radio name = "location"). If the second radio button is selected (value ="2"), then users must select from a dropdown list (name = "listRightA").

Any help appreciated.

Khalid Ali
08-08-2003, 07:37 PM
The link below should give you the idea.it uses the same logic to implement the idea with check box and text field.

http://68.145.35.86/skills/javascripts/ForceInputCheckboxSelected.html

kierenj
08-11-2003, 11:06 AM
Thanks for that. Unfortunatly I need something that will work on Netscape 4 and IE 5. I am new to javascript and I have having trouble adapting your script. Any additonal help would be much appreciated.

kierenj
08-11-2003, 12:49 PM
I figured out a solution that seems to work

<script type="text/javascript">
<!-- hide me from old browsers
function validate() {
if (document.form1.location[1].checked && document.form1.listRightA.selectedIndex <0) {
alert ("Please select at least one area");
return false;
}
else {
return true;
}
}
// end hiding comment -->
</script>