mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-06-26 07:13:21 +00:00
Fix validator compatibility break (#40230)
This commit is contained in:
parent
e65d28486b
commit
b285fa67e4
|
@ -249,10 +249,15 @@ class JFormValidator {
|
|||
let valid = true;
|
||||
let message;
|
||||
let error;
|
||||
let fields;
|
||||
const invalid = [];
|
||||
|
||||
// Validate form fields
|
||||
const fields = [].slice.call(form.elements);
|
||||
if (form.nodeName === 'FORM') {
|
||||
fields = [].slice.call(form.elements);
|
||||
} else {
|
||||
fields = [].slice.call(form.querySelectorAll('input, textarea, select, button, fieldset'));
|
||||
}
|
||||
fields.forEach((field) => {
|
||||
if (this.validate(field) === false) {
|
||||
valid = false;
|
||||
|
@ -284,7 +289,13 @@ class JFormValidator {
|
|||
|
||||
attachToForm(form) {
|
||||
const inputFields = [];
|
||||
const elements = [].slice.call(form.elements);
|
||||
let elements;
|
||||
|
||||
if (form.nodeName === 'FORM') {
|
||||
elements = [].slice.call(form.elements);
|
||||
} else {
|
||||
elements = [].slice.call(form.querySelectorAll('input, textarea, select, button, fieldset'));
|
||||
}
|
||||
|
||||
// Iterate through the form object and attach the validate method to all input fields.
|
||||
elements.forEach((element) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user