{"id":19037674,"date":"2026-10-06T11:13:49","date_gmt":"2026-10-06T11:13:49","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/inline-validation-sets-errors-on-fields-inside-novalidate\/"},"modified":"2026-10-06T11:13:49","modified_gmt":"2026-10-06T11:13:49","slug":"inline-validation-sets-errors-on-fields-inside-novalidate","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/inline-validation-sets-errors-on-fields-inside-novalidate\/","title":{"rendered":"Inline validation sets errors on fields inside .novalidate"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Fields inside a <code>.novalidate<\/code> element are left out of the form data in <code>validate()<\/code> (<code>includes\/js\/src\/validate.js<\/code>), but the loop that sets the errors does not skip them. They fail the <code>required<\/code> rule and show &#8220;Please fill out this field.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Steps to reproduce<\/strong>: create this form, then type something in <code>field-b<\/code> and leave the field.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;div class=\"novalidate\"&gt;&#091;text* field-a]&lt;\/div&gt;<br \/>&#091;text field-b]<br \/>&#091;submit]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Expected<\/strong>: no error on <code>field-a<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Actual<\/strong>: <code>field-a<\/code> shows &#8220;Please fill out this field.&#8221;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Fix<\/strong>: skip <code>.novalidate<\/code> wraps in the loop that sets the errors:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for (const wrap of wrapList) {<br \/>  if (undefined === wrap.dataset.name) {<br \/>    continue;<br \/>  }<br \/><br \/>  \/\/ add this:<br \/>  if (wrap.closest(\".novalidate\")) {<br \/>    continue;<br \/>  }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Tested with 6.2.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PS: Seems like I&#8217;m blocked from creating issues on the github repo <a href=\"https:\/\/github.com\/rocklobster-in\/contact-form-7\">https:\/\/github.com\/rocklobster-in\/contact-form-7<\/a>. Would you consider allowing me to post issues and PRs in your github repo? My github name is <a href=\"https:\/\/github.com\/pwkip\">pwkip<\/a>.<\/p>\n","protected":false},"template":"","class_list":["post-19037674","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19037674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19037674\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19037674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}