From 962b540f0cd2f905c7f5074fcade2a4453eb25ab Mon Sep 17 00:00:00 2001 From: Bo Peng Date: Tue, 2 Mar 2021 12:40:33 -0600 Subject: [PATCH] validate form even if the form is submitted from an element within it --- src/htmx.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/htmx.js b/src/htmx.js index cb9016ce..3ad14011 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -1661,7 +1661,7 @@ return (function () { var errors = []; // only validate when form is directly submitted and novalidate is not set - var validate = matches(elt, 'form') && elt.noValidate !== true; + var validate = (matches(elt, 'form') || closest(elt, 'form')) && elt.noValidate !== true; // for a non-GET include the closest form if (verb !== 'get') {