• robwebfx

    (@robwebfx)


    Hey!

    We have a form with a required signature field (e.g. [signature*]). We noticed that if we submitted the form without a value, the field would not appear as invalid.

    CF7 applies the wpcf7-not-valid HTML class and “Please fill out this field” tooltip by targeting the .wpcf7-form-control-wrap elements that contain the inputs. However, CF7 targets these elements through their data-name props, which isn’t currently being added: https://rob.webpagefxdev.com/snaps/1701189015 (file: main/backend/digital-signature-backend-cf7.php).

    Could this be updated to the following?

    <?php
    
    $html = sprintf(
    '<div class="dscf7_signature">
      <div class="dscf7_signature_inner">
        <canvas id="digital_signature-pad_%1$s" name="%1$s" class="digital_signature-pad" %4$s></canvas>
        <input class="clearButton" type="button" value="+">
      </div>
      <span class="wpcf7-form-control-wrap %1$s" data-name="%7$s">
        <input %2$s />
        <input %5$s class="wpcf7_input_%1$s_attachment" />
        <input %6$s class="wpcf7_input_%1$s_inline" />%3$s
      </span>
    </div>',sanitize_html_class($tag->name) , $atts, $validation_error ,$attsa ,$atts_attach,$atts_inline, esc_attr( $tag->name ) );
    return $html;

    This should then work with CF7’s invalidation functionality! (example: https://rob.webpagefxdev.com/snaps/1701189232)

  • The topic ‘Bug with invalidation’ is closed to new replies.