kuau
12-08-2009, 04:21 AM
I hope someone can see what I cannot. This should be so simple. I have a form to which I have applied some simple Javascript validation to make required fields. It works perfectly for 12 of the fields but I can't get it to work on the last field. The only difference is that for the first 12 fields I am checking to see if the text field is blank, whereas the last field is a radio button with 2 choices: Yes or No, so I am checking if the value is "No" or not.
The Javascript is:
function validate() {
if (document.infoform.agreed.value == "No") {
alert("You MUST agree to our Terms.");
return false;
}
return true;
}
The form code is:
I agree <input type="radio" name="agreed" value="No" checked> No <input type="radio" name="agreed" value="Yes"> Yes
I load the results into a table and when No is checked it does load "No". This is driving me nuts. If I use == "No" it gives no alert. If I use != "Yes" it gives an alert no matter what is checked.
Please help! Thanks, e :)
The Javascript is:
function validate() {
if (document.infoform.agreed.value == "No") {
alert("You MUST agree to our Terms.");
return false;
}
return true;
}
The form code is:
I agree <input type="radio" name="agreed" value="No" checked> No <input type="radio" name="agreed" value="Yes"> Yes
I load the results into a table and when No is checked it does load "No". This is driving me nuts. If I use == "No" it gives no alert. If I use != "Yes" it gives an alert no matter what is checked.
Please help! Thanks, e :)