• Hi, I need forms to be usable (and validate) without JS.

    Since wpcf7_form_novalidate was removed in CF7 version 5.7 – would you be willing to either bring it back, or implement an alternative (perhaps something in Additional Settings)? Or is there an alternative, already?

    It used to be simple enough:

    add_filter(
      'wpcf7_form_novalidate',
      function( $support_html5 ) {
        return null;
      }
    );

    Now, it feels a lot hackier 😉

    add_filter(
      'the_content',
      function ( $content ) {
        return preg_replace( '/(<form .*class="wpcf7-form.*) novalidate="novalidate"(.*>)/isU', '\1\2', $content );
      },
      PHP_INT_MAX
    );

    Thanks for CF7!

  • The topic ‘Native HTML form validation needed (back)’ is closed to new replies.