-
Notifications
You must be signed in to change notification settings - Fork 66
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
Binder ignores invalid value in DatePicker #1268
Comments
I'm not sure what we can do about this, since technically, the value of that date field is |
The component API does have a property named "invalid" that could be used. Or is there something preventing sending this property to the server? At least it can't be left as it currently is. It's very confusing for the user and it also breaks forms where the save button is enabled based on validity. |
As I understand the server side never knows about |
@Legioth: It could be a solution to enforce a regular expression at client side. com.vaadin.flow.component.textfield.TextField offers a method setPattern and with a pattern set the client side avoids typing in invalid characters. That works fine. Couldn't you set a pattern like "\d{1,2}.\d{1,2}.\d{2,4}" at the DatePicker? Ideally (and in my case a must-have) depending on the locale. |
Now when I come to think of it, this is already fixed in Vaadin 8 with the "default validator" concept which allows the field component to provide its own custom validator logic that is automatically used by |
For reference: We have the same issue with ComboBox: Write an incorrect value and tab out, and the value is reset. https://github.com/vaadin/vaadin-combo-box/issues/864 For ComboBox there is special support for allowing invalid values, which can be used as a workaround, but maybe ComboBox, DatePicker and other fields should have a unified approach to invalid values? From my point of view I want all state to be available on the server-side, so I wouldn't mind all textfield components also having access to the textfield value. Valid or not. |
Miki is fixing a similar issue in his SuperFields add-on, here: vaadin-miki/super-fields#241 . Even though the issue relates to BigDecimalField, the fix should also affect DatePicker. After the fix is released, please try using the SuperDatePicker. |
Would appreciate a fix for this issue. Thanks. |
FYI: We have just introduced new validation behavior that is supposed to solve many different validation issues that people were complaining about, including this one. The new behavior is available under the feature flag in v23.2 for several components including DatePicker. To enable the feature flag in your application, add the following to
Any feedback would be highly appreciated. For more details, please refer to vaadin/platform#3066. |
The issue has been resolved by the new validation mechanism which is enabled by default in Vaadin 24. For any further bugs, please create separate issues. |
The text was updated successfully, but these errors were encountered: