From b62f5194be57171b4ab090703d22d184895db6aa Mon Sep 17 00:00:00 2001 From: Jordan Cannon Date: Fri, 28 Jul 2023 00:57:28 -0500 Subject: [PATCH 1/2] Fix logic of isFieldValid by checking if equal to undefined rather than not equal to null --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index b50ede4..435f1da 100644 --- a/src/index.ts +++ b/src/index.ts @@ -788,7 +788,7 @@ export class ValidationService { } let fieldUID = this.getElementUID(field); - return this.summary[fieldUID] != null; + return this.summary[fieldUID] === undefined; } /** From ff53d94582e4298bacab12ba10018335e12e2033 Mon Sep 17 00:00:00 2001 From: Jordan Cannon Date: Fri, 28 Jul 2023 01:04:22 -0500 Subject: [PATCH 2/2] Add errors to all validatable elements not just inputs --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 435f1da..dbf381d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1056,7 +1056,7 @@ export class ValidationService { if (input.form) { // Adding an error to one input should also add it to others with the same name (i.e. for radio button and checkbox lists). - const inputs = input.form.querySelectorAll(`input[name="${input.name}"]`); + const inputs = input.form.querySelectorAll(validatableSelector(`[name="${input.name}"]`)); for (let i = 0; i < inputs.length; i++) { this.swapClasses(inputs[i], this.ValidationInputCssClassName,