troubleshooting Question

How make sure a checkbox is checked before form submit?

Avatar of tingleweb
tinglewebFlag for United Kingdom of Great Britain and Northern Ireland asked on
JavaScript
7 Comments1 Solution1046 ViewsLast Modified:
Hi

I am using the code from http://www.javascript-coder.com/html-form/javascript-form-validation.phtml in my form:

here is an extract of the code - unfortunately whether the checkbox (termsagreed) is checked or not - I still get the 'required fields not completed' popup.  How can I only get it to appear if the form is submitted with termsagreed unchecked?

________________________________________________________________________________________________

<label for="terms-agreed" id="terms">I have read and agree with the Terms &amp; Conditions*</label>
<input name="termsagreed" type="checkbox" id="termsagreed" value="" class="termsCheck" />

<div id="detailsButtons2"><input type="image" src="images/but-continue.gif" alt="continue" id="but3" /></div>      

</fieldset>                        
</form>                        

<script language="JavaScript" type="text/javascript">
 var frmvalidator = new Validator("form1");
 frmvalidator.addValidation("termsagreed","req","Please read and agree with the Terms & Conditions");
</script>

________________________________________________________________________________________________
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros