• I have a contact form with some hidden div’s which contain additional CF7 form fields.

    I am using jQuery to show/hide the extra form fields based on a <select> value.

    I have the form fields initially set as not required in the contact form 7 template.

    I am using jQuery to add/remove the wpcf7-validates-as-required class to the input’s when shown or hidden. I’m also add the attr aria-required=”true”

    However, the form fields do not validate as required after adding the css class when shown.

    Is the form validation client side or server side? Is there a way to make input fields that are initially not required become required via client side changes?

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is the form validation client side or server side?

    Client side – uses JavaScript.

    Examine the CF7 JavaScript to see your options.

    Thread Starter randmanrjr

    (@randmanrjr)

    I’ve looked that the CF7 javascript. Looks like the validation is done on the server after the ajax submit. Validation errors are returned to the script and then the css classes of the inputs are updated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Contact Form 7 form validation’ is closed to new replies.