fixed radios still validating while having no value and marked as optional

This commit is contained in:
2025-04-07 11:05:02 -04:00
parent b232313c59
commit eb9a292586

View File

@ -202,9 +202,9 @@ class Validation {
for (const nameAttr of this.reqData) { for (const nameAttr of this.reqData) {
const fields = this.form.querySelectorAll(`[name="${nameAttr}"]:where(input, select, textarea)`) const fields = this.form.querySelectorAll(`[name="${nameAttr}"]:where(input, select, textarea)`)
for (const el of fields) { for (const el of fields) {
// checkbox specfic // combine all data-validation attr properties between
if (el.type === 'checkbox') { // check/radio groups and copy to all inputs in the group
// combine all data-validation attrs and copy to all checks in the group if (el.type === 'checkbox' || el.type === 'radio') {
const checks = this.form.querySelectorAll(`input[name="${el.name}"]`) const checks = this.form.querySelectorAll(`input[name="${el.name}"]`)
let multiOptions = {} let multiOptions = {}
for (const check of checks) { for (const check of checks) {