You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing a validation constraint on any text field based component does not trigger validation on the server-side. That means that adding or removing constraints with an existing value has no effect on the validity of the component.
When changing a constraint on the server-side, the server-side validation should be run again, and the server-side validation state of the component should update. This seems to affect any text field based components (possibly all components featuring validation), and all constraints (min length, max length, pattern, ...). Note that for some constraints the web-component also does not update correctly (min length).
When solving this we also need to consider edge-cases, for example:
we do not want to run validation if the user has not interacted with a field yet, otherwise setting a constraint would mark it as invalid immediatly even though the user did not have a chance to enter something
how to handle programmatically set values and initial values
Live Demo (optional)
n/a
Minimal reproducible example
TextFieldtextField = newTextField();
NativeButtonsetConstraint = newNativeButton(
"Set min length constraint",
e -> textField.setMinLength(10)
);
NativeButtonreportValidity = newNativeButton(
"Report validity",
e -> System.out.println("Text field is valid: " + !textField.isInvalid())
);
add(textField, setConstraint, reportValidity);
Steps to reproduce
Run the example above
Enter abc
Click Report validity
Console logs Text field is valid: true
Click Set min length constraint
Click Report validity again
Console logs Text field is valid: true
Expected outcome
The component should report as invalid.
Actual outcome
The component still reports as valid.
Environment
tested with v23, but this should affect all versions, as the logic was seemingly never implemented
Browsers Affected
Tested with:
Chrome
Firefox
The text was updated successfully, but these errors were encountered:
Description
Changing a validation constraint on any text field based component does not trigger validation on the server-side. That means that adding or removing constraints with an existing value has no effect on the validity of the component.
When changing a constraint on the server-side, the server-side validation should be run again, and the server-side validation state of the component should update. This seems to affect any text field based components (possibly all components featuring validation), and all constraints (min length, max length, pattern, ...). Note that for some constraints the web-component also does not update correctly (min length).
When solving this we also need to consider edge-cases, for example:
Live Demo (optional)
n/a
Minimal reproducible example
Steps to reproduce
abc
Report validity
Text field is valid: true
Set min length constraint
Report validity
againText field is valid: true
Expected outcome
The component should report as invalid.
Actual outcome
The component still reports as valid.
Environment
Browsers Affected
Tested with:
The text was updated successfully, but these errors were encountered: