-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation refactor to fix issues related to the validated event #5537
Comments
Note, also client side validation is triggered on blur even if nothing has been typed as seen here: vaadin/web-components#6587 |
I'd like to clarify that this proposal focuses only on Flow components. It's specifically designed in a way that avoids modifying any existing behavior of the web components, such as validation on blur, for example. If you believe that the web components shouldn't validate on blur, feel free to create a separate ticket. |
This refactor is planned to be delivered by 24.3-beta. |
The refactor has covered all input components apart from |
Closing this issue as completed. DateTimePicker issues will be addressed in #6697. |
Motivation
There are several problems with the current approach based on the validated event:
All these problems have emerged after the introduction of the validated event, so we need to find an alternative. We should remember that the underlying purpose of the validated event was to trigger server-side validation when the user enters bad input, as there is no change event in that case.
Solution
For components that allow entering bad input, let’s replace the validated event with a new event
unparsable-change
:However, switching to the new event will address (4) only partially. The validation will be still inconsistent in eager mode: text fields will validate on input when entering valid values but on change when entering bad input. To improve this, let’s additionally subscribe the text field Flow components to
hasInputValue
property change and trigger validation when it occurs in eager mode.For the rest components, let's remove the validated event so that they will only validate on change event.
Affected components
Alternatives
Pros:
Cons:
Additional context
Related Github discussion: https://github.com/orgs/vaadin/discussions/4434
Related AC that introduced the validated event: vaadin/platform#3066
The text was updated successfully, but these errors were encountered: