-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(form validation): array validations should respect each single field
If a form uses array inputs by appending brackets to their names ( `name="myfield[]"`) the validation on those fields was always done for the whole field group. Means, if the first field was valid, it validated for the whole group which is wrong. This behavior is now fixed, so even if multiple input fields have the same name to act as array inputs, the validation is done on each field separately and also the error class is set/removed to each field individually. @prudho was already providing a [PR for that in SUI](Semantic-Org/Semantic-UI#6370) some time ago, but the individual error display handling was missing there. Hint: If you ask yourself while reviewing, why i added an `internal` parameter to the `add.prompt()`and `validate.rule()` functions: This is to make sure those functions are still callable as behavior from separate JS (for example: `$('.foo').form('validate rule', argumentOne, argumentTwo)` so they do not break existing code
- Loading branch information
Showing
1 changed file
with
42 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters