I have created a form that requires checking a box certifying that you agree to terms.
This is the last item on the form which contains mostly address info. I then added the following javascript:Code:<input name="certify" type="checkbox" value="Y" ID="CertChkbox"/>
I am not sure what I am doing wrong. How can I validate the checkbox?Code:<script> function validateForm() { var x=document.forms["PledgeForm"]["FirstName"].value; if (x==null || x=="") { alert("First name is a required field and must be completed"); return false; } var x=document.forms["PledgeForm"]["LastName"].value; if (x==null || x=="") { alert("Last name is a required field and must be completed"); return false; } this goes on for a few more fields and then I tried adding the following code for the checkbox: if (PledgeForm.Certify.value == null) { alert("error message"); }
Thanks in advance.




Reply With Quote