I have a form that has 4 “required fields” that validate using JS. I am now trying to add a 5th “required field” (the difference is that this field is a "radio button input as opposed to a text input).
I have it working so that when the 1st radio button is selected, the form will go through. However, when the 2nd radio button is selected, it comes up with the “please fill in all required fields” error.
Here is the JS I have so far:
<script type="text/JavaScript">
function verify() {
var Skill = document.indiv_reg.skill.value;
var Fname = document.indiv_reg.name.value;
var Hphn = document.indiv_reg.home_num.value;
var Email = document.indiv_reg.email.value;
var Tname = document.indiv_reg.tname.value;
if ((Fname =="") || (document.indiv_reg.skill[0].checked =="") || (Hphn =="") || (Email =="") || (Tname =="")) {
alert('Please Fill Out ALL Required Fields');
}
else {
document.indiv_reg.submit();
}
}
</script>
I tried adding the 2nd radio button value like this:
(document.indiv_reg.skill[0].checked =="") || (document.indiv_reg.skill[1].checked =="")
But when I do that, then even when the 1st radio button is selected it comes up with the “please fill out all required fields error”.
<?php
* Denotes a Required Field<br />
<br />
<form name="indiv_reg" method="GET" action="tourney_mailRedirect.php">
Sport:<br />
<input type="text" name="sport" value="'.$sport.'" readonly="readonly" /><br />
<br />
Tournament:<br />
<input type="text" size="90" name="league" value="'.$league.'" readonly="readonly" /><br />
<br />
* Please select preferred skill level:<br />
<input type="radio" name="skill" value="recreational" /> Recreational<br />
<input type="radio" name="skill" value="competitive" /> Competitive<br />
<br />
* Name:<br />
<input type="text" name="name" /><br />
<br />
* Team Name:<br />
<input type="text" name="tname" /><br />
<br />
Team Captain:<br />
<input type="text" name="tcap" /><br />
<br />
* Home Phone:<br />
<input type="text" name="home_num" /><br />
<br />
Cell Phone:<br />
<input type="text" name="cell_num" /><br />
<br />
* Email:<br />
?>
Not sure what to to. Any help would be appreciated.