From eb9a292586e9e9a34a10d8318d782476b0ddc9ae Mon Sep 17 00:00:00 2001 From: Dan Remollino Date: Mon, 7 Apr 2025 11:05:02 -0400 Subject: [PATCH] fixed radios still validating while having no value and marked as optional --- validation.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/validation.js b/validation.js index 4174d77..727ad66 100644 --- a/validation.js +++ b/validation.js @@ -202,9 +202,9 @@ class Validation { for (const nameAttr of this.reqData) { const fields = this.form.querySelectorAll(`[name="${nameAttr}"]:where(input, select, textarea)`) for (const el of fields) { - // checkbox specfic - if (el.type === 'checkbox') { - // combine all data-validation attrs and copy to all checks in the group + // combine all data-validation attr properties between + // check/radio groups and copy to all inputs in the group + if (el.type === 'checkbox' || el.type === 'radio') { const checks = this.form.querySelectorAll(`input[name="${el.name}"]`) let multiOptions = {} for (const check of checks) {