validate_form(): add support of Bootstrap switches

This commit is contained in:
Benjamin Renard 2024-12-28 02:03:41 +01:00
parent 075519220b
commit 2beee5c645
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC

View file

@ -148,6 +148,11 @@ function validate_form(form, keep_empty = false) {
data[$(checkbox).attr("name")] = $(checkbox).is(":checked");
}
});
form.find(".form-switch input[type=checkbox]").each(function (idx, checkbox) {
if ($(checkbox).attr("name")) {
data[$(checkbox).attr("name")] = $(checkbox).is(":checked");
}
});
console.log(data);
return data;
}