-
Notifications
You must be signed in to change notification settings - Fork 167
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 bean validation is not triggered properly in Vaadin 24 #18163
Comments
The issue goes away when I remove the Although, it does run them when the revalidation is caused by This gives me the impression that it might be a bug in Binder. @mshabarov Could you check that please? |
@vursen the behaviour described above doesn't seem correct to me. I would expect that if I set the binder-level validator with So far I think this is a bug in Flow Binder. By the way, I didn't get how |
Similar behaviour is described here by the way. |
Changes: - Once Binder.handleFieldValueChange runs for a binding when readBean was used, the whole binder will be silently validated also. BinderValidationStatusHandler is called like before (only contains status from changed binding), but StatusChangeEvent is now fired considering all bindings and if possible bean validators as well. - Once Binder.handleFieldValueChange runs for a binding when setBean was used, doWriteIfValid will validate all bindings, not only the changed ones. This prevents writing an invalid bean in cases where one or more of the initial values are in invalid state (but not marked as such since setBean resets validation status), but they have not been changed from their initial value(s). Calling setAsRequiredEnabled with a changed value no longer triggers validation, since that validation is now handled elsewhere when needed as stated above. Minor Javadoc fixes, trying to align Javadocs with code. Fixes #18163 Fixes #4988 Fixes #17515
Changes: - Once Binder.handleFieldValueChange runs for a binding when readBean was used, the whole binder will be silently validated also. BinderValidationStatusHandler is called like before (only contains status from changed binding), but StatusChangeEvent is now fired considering all bindings and if possible bean validators as well. - Once Binder.handleFieldValueChange runs for a binding when setBean was used, doWriteIfValid will validate all bindings, not only the changed ones. This prevents writing an invalid bean in cases where one or more of the initial values are in invalid state (but not marked as such since setBean resets validation status), but they have not been changed from their initial value(s). Calling setAsRequiredEnabled with a changed value no longer triggers validation, since that validation is now handled elsewhere when needed as stated above. Minor Javadoc fixes, trying to align Javadocs with code. Fixes #18163 Fixes #4988 Fixes #17515
Changes: - Once Binder.handleFieldValueChange runs for a binding when readBean was used, the whole binder will be silently validated also. BinderValidationStatusHandler is called like before (only contains status from changed binding), but StatusChangeEvent is now fired considering all bindings and if possible bean validators as well. - Once Binder.handleFieldValueChange runs for a binding when setBean was used, doWriteIfValid will validate all bindings, not only the changed ones. This prevents writing an invalid bean in cases where one or more of the initial values are in invalid state (but not marked as such since setBean resets validation status), but they have not been changed from their initial value(s). Calling setAsRequiredEnabled with a changed value no longer triggers validation, since that validation is now handled elsewhere when needed as stated above. Minor Javadoc fixes, trying to align Javadocs with code. Fixes #18163 Fixes #4988 Fixes #17515
Changes: - Once Binder.handleFieldValueChange runs for a binding when readBean was used, the whole binder will be silently validated also. BinderValidationStatusHandler is called like before (only contains status from changed binding), but StatusChangeEvent is now fired considering all bindings and if possible bean validators as well. - Once Binder.handleFieldValueChange runs for a binding when setBean was used, doWriteIfValid will validate all bindings, not only the changed ones. This prevents writing an invalid bean in cases where one or more of the initial values are in invalid state (but not marked as such since setBean resets validation status), but they have not been changed from their initial value(s). Calling setAsRequiredEnabled with a changed value no longer triggers validation, since that validation is now handled elsewhere when needed as stated above. Minor Javadoc fixes, trying to align Javadocs with code. Fixes #18163 Fixes #4988 Fixes #17515 Co-authored-by: Teppo Kurki <[email protected]>
Changes: - Once Binder.handleFieldValueChange runs for a binding when readBean was used, the whole binder will be silently validated also. BinderValidationStatusHandler is called like before (only contains status from changed binding), but StatusChangeEvent is now fired considering all bindings and if possible bean validators as well. - Once Binder.handleFieldValueChange runs for a binding when setBean was used, doWriteIfValid will validate all bindings, not only the changed ones. This prevents writing an invalid bean in cases where one or more of the initial values are in invalid state (but not marked as such since setBean resets validation status), but they have not been changed from their initial value(s). Calling setAsRequiredEnabled with a changed value no longer triggers validation, since that validation is now handled elsewhere when needed as stated above. Minor Javadoc fixes, trying to align Javadocs with code. Fixes #18163 Fixes #4988 Fixes #17515 Co-authored-by: Teppo Kurki <[email protected]>
This ticket/PR has been released with Vaadin 24.3.4. |
I have a similar problem to this related to DateTimePickers in Vaadin 24.4.7 If I change Jean-Christophe Gueriaud's code snipplet above to use LocalDateTimes and DateTimePickers, then I get the same problem again. `public class HelloWorldView extends HorizontalLayout {
} In this case, validationStatusHandler is called 2 times, first time with the error from the bean level validator and the second time without any errors which clears the previous error message, so it matches the behaviour of this ticket even though it is marked as closed. |
Description
When I set a validator on the binder, the setValidationStatusHandler does not show the error.
In Vaadin 23, the error was displayed.
Expected outcome
The error should be displayed and the binder status should be in error.
Minimal reproducible example
See these 2 branches:
https://github.com/jcgueriaud1/spring-proxy-issue/tree/bean-validation-v24
https://github.com/jcgueriaud1/spring-proxy-issue/tree/bean-validation-v23
Steps to reproduce
Open the view type xx as no field value = test the error should be displayed.
Environment
Vaadin version(s): 24.1.4
Browsers
No response
The text was updated successfully, but these errors were encountered: