I have two contact forms, one is in includes/footer.php and one on contact.php and when on the contact page, if I try to submit the form in the footer, it won't submit because I got checkbox validation on each form that the user has to agree to the terms before the form submits so tried the following but either form still don't submit unless both checkboxes are checked
the form checkbox code in the footer.php is below
The form checkbox code on the contact page is belowCode:<div class="col-md-12 mb-3"> <input type="checkbox" id="agreefooter" /> I have read and agree to MM PC Solutions <a href="privacy-policy.php" target="_blank">Privacy Policy</a> </div> <script> $(".needs-validation").submit(function(e){ if(!$("#agreefooter").is(":checked")){ alert('Please indicate that you have read MM PC Solutions Privacy Policy'); e.preventDefault(); } }); </script>
Can anyone help please so the forms don't conflict and allows to me submit the form if either form does not have the checkbox in their form checkedCode:<div class="col-md-12 mb-3"> <input type="checkbox" id="agreecontact" /> I have read and agree to MM PC Solutions <a href="privacy-policy.php" target="_blank">Privacy Policy</a> </div> <script> $(".needs-validation contactform").submit(function(e){ if(!$("#agreecontact").is(":checked")){ alert('Please indicate that you have read MM PC Solutions Privacy Policy'); e.preventDefault(); } }); </script>
Hope that makes sense



Reply With Quote
Bookmarks