Search code examples
wordpresscontact-form-7

Contact form 7 version 5.2


I have recently updated my contact form 7 plugin to version 5.7.2. Everything is working fine but one thing.

I have a form with 4 fields and a privacy checkbox below. All fields are mandatory. When I click on privacy checkbox without entering anything in above 4 inputs, an error message is displayed.

I want to remove those validations. I want to only display errors when the user clicks on the submit button, not on the lost focus of inputs or the checking of box. I was unable to find a solution.

Can anyone help me here?

This is the link to check this issue - https://sawstg.wpengine.com/contact-us/

I tried to remove the error spans with jquery when the checkbox is clicked, but its not working


Solution

  • A workaround is to include the following script on your website. This will prevent the validation event from triggering when clicking on a checkbox.

    $('.wpcf7 input[type="checkbox"]').on("change", function(e) {
      e.stopPropagation();
    });