Skip to content

Commit 4f706c2

Browse files
authored
fix(formvalidation): skip undefined identifiers
Whenever a form contains input fields without any id or name attribute in a form, they cannot be identified automatically by the formvalidation when collecting form input fields and no manual validation rule is given. Such input elements should always be declared as "valid". The current code already ignored them at least, but still tried to validate them and failed while trying to fetch the identifier as it wasnt found in any rule and also couldnt be fetched automatically from an id or name attribute. Such "undefined" elements had an error logged in the console instead, which is unnecessary. However, the whole validation still worked fine, only the console message could be mislead. This was now adjusted, so such undefined identifiers will be declared as valid.
1 parent 6f9d3b6 commit 4f706c2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/definitions/behaviors/form.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,6 +1253,11 @@
12531253
return true;
12541254
}
12551255
const identifier = field.identifier || fieldName;
1256+
if (!identifier) {
1257+
module.debug('No identifier given. Skipping');
1258+
1259+
return true;
1260+
}
12561261
const $field = module.get.field(identifier);
12571262
const $fieldGroup = $field.closest($group);
12581263
const $dependsField = field.depends

0 commit comments

Comments
 (0)