Support » Plugin: Contact Form 7 » [Plugin: Contact Form 7] Validate Visible Fields Only

  • I’d like the validation to ignore required fields that are hidden. On my form I have 3 radio buttons. The second and third buttons, when selected, reveal additional fields. One of those fields is required but when it’s hidden I’m getting a validation error and it prevents the form from sending. I’ve tried adding the code below to my javascript file which is working fine (other than that) but it doesn’t seem to do anything.

    $('#671').validate({'ignore' : ':hidden'});

    I also tried populating the hidden fields with “n/a” so they’d be filled and would pass validation but that didn’t work either.

    $('.hide input').val('n/a');

    Please advise, I’m going a little crazy.


Viewing 1 replies (of 1 total)
  • Hi! Did you ever manage to make this work? I have created a custom code that removes the wpcf7-validates-as-required class from the hidden fields, but it’s still trying to validate.

    I have also installed the “jquery validation for contact form 7” plugin, which doesn’t try to validate the hidden fields if they don’t have that class, but even though this plugin is supposed to override contact form 7’s validation, the form still doesn’t go through because and ends up with the original error message “Validation errors occurred. Please confirm the fields and submit it again.”. If you ever found a solution I’d appreciate you sharing it. Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Contact Form 7] Validate Visible Fields Only’ is closed to new replies.