Need help validating radio buttons with JavaScript
I've read over a large number of other questions like mine that have been
answered, and I still can't seem to get my code to work. Hoping someone
can shed light onto where I'm going wrong.
Here's the section of HTML:
<span class="formbold">Will you be attending the ceremony and
reception?</span><br/>
<input type="radio" name="receptionattend" value="yesboth" /> Yes, both!<br/>
<input type="radio" name="receptionattend" value="yesc" /> Yes, but only
the ceremony! <br/>
<input type="radio" name="receptionattend" value="yesr" /> Yes, but only
the reception!<br/>
<input type="radio" name="receptionattend" value="no" /> No, you guys are
lame!
And here's the simplest validation code I have:
function validateForm()
var y=document.forms["rsvpform"]["receptionattend"].checked;
if (y==null || y=="")
{
alert("Please indicate whether or not you will attend.");
return false;
}
}
HALP!
No comments:
Post a Comment