• Fields inside a .novalidate element are left out of the form data in validate() (includes/js/src/validate.js), but the loop that sets the errors does not skip them. They fail the required rule and show “Please fill out this field.”

    Steps to reproduce: create this form, then type something in field-b and leave the field.

    <div class="novalidate">[text* field-a]</div>
    [text field-b]
    [submit]

    Expected: no error on field-a.

    Actual: field-a shows “Please fill out this field.”

    Fix: skip .novalidate wraps in the loop that sets the errors:

    for (const wrap of wrapList) {
    if (undefined === wrap.dataset.name) {
    continue;
    }

    // add this:
    if (wrap.closest(".novalidate")) {
    continue;
    }

    Tested with 6.2.

    PS: Seems like I’m blocked from creating issues on the github repo https://github.com/rocklobster-in/contact-form-7. Would you consider allowing me to post issues and PRs in your github repo? My github name is pwkip.

Viewing 1 replies (of 1 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Use of the novalidate class is an undocumented feature, meaning there’s no guarantee you can continue using it. Relying on it for a production website is not recommended. Anyway, I’ll look into it closely.

    PS: Seems like I’m blocked from creating issues on the github repo https://github.com/rocklobster-in/contact-form-7.

    Sorry for that. I just unblocked you. I thought I had done it last year.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.