-
Notifications
You must be signed in to change notification settings - Fork 79
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
Input components chained validation logic #3066
Comments
This PR adds a feature flag for the new field validation behavior. The flag will be used by Flow field components. For more information about the new behavior, please refer to vaadin/platform#3066. Part of vaadin/platform#3066
The new validation behavior is now available under the feature flag in v23.2 for the following components:
To try it out, enable the feature flag in your application by adding the following to
|
Here is a summary of the changes implemented as part of this ticket: Binder Takes Into Account Component ConstraintsEvery field component provides its own set of constraints such as BeforeWhen using Binder, it ignored component constraints, so they would only affect UX but not the server-side invalid state. AfterComponent constraints are integrated into Binder validation. Binder checks the value against constraints before running custom validators. The only exception is the Limitations
Blur Triggers Server-Side ValidationBeforeBoth constraint and binder validation were only triggered on value change while client-side validation was completely ignored. AfterThe server-side validation timing is aligned with client-side validation, meaning that whenever the web component validation occurs, it triggers the corresponding validation in the Flow component. In practice, it means that the server-side validation will be also performed on Limitations
Entering Bad Input Invalidates The ComponentDatePicker, IntegerField, and some other similar components only accept user input that can be parsed as a BeforeEntering bad input didn't invalidate the component because the server treated this case as an empty value. AfterThe server knows if the user has entered some input. When it cannot be parsed, it's considered bad input and will cause constraint validation to fail once the user presses Enter or removes focus from the component. Affected ComponentsThe above changes apply to the following components:
|
Description
Chaining validation in the components when web-component, flow counterpart and Binder are used together.
Validation should happen in the order 1. web-component, 2. Flow component, 3. Binder.
Problems with current validation behavior
qwerty
string is not sent to flow componentDatePicker
as it's not of typeLocalDate
)Use cases
As a developer
I want my field to be validated on blur / value changed regardless of flow component, Binder usage.
As a developer
I want my field's validation constraints to be chained through web-component, flow component and Binder.
Acceptance criteria
HasValidator
and providegetDefaultValidator
addValidationStatusChangeListener
to triggerBinder
validation when web-component and Flow component validations are done.Related Flow issue
General criteria
The text was updated successfully, but these errors were encountered: