This commit is contained in:
2025-08-16 14:40:38 +05:30
parent f3fb2f1b1f
commit 1ebad85d89
+5
View File
@@ -323,9 +323,12 @@ const formId = `f-${Math.random().toString(36).slice(2)}`;
.map((s) => s.trim())
.filter(Boolean);
console.log(validateOn);
if (validateOn.includes("input")) {
form.addEventListener("input", (e) => {
const root = e.target?.closest?.("[data-field]");
console.log("input:", root);
if (!root) return;
const name = root.getAttribute("data-field");
if (name) validateField(name);
@@ -336,6 +339,7 @@ const formId = `f-${Math.random().toString(36).slice(2)}`;
"blur",
(e) => {
const root = e.target?.closest?.("[data-field]");
console.log("blur:", root);
if (!root) return;
const name = root.getAttribute("data-field");
if (name) validateField(name);
@@ -346,6 +350,7 @@ const formId = `f-${Math.random().toString(36).slice(2)}`;
if (validateOn.includes("change")) {
form.addEventListener("change", (e) => {
const root = e.target?.closest?.("[data-field]");
console.log("change:", root);
if (!root) return;
const name = root.getAttribute("data-field");
if (name) validateField(name);