Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
BeanValidations on first render
Noob here so I'll pester you with some questions ;-)
I'm trying to build a login form with a BeanFieldGroup and JSR-303 @NotNull annotations on the Credentials username and password fields. Apparently the validators are called on the render pass since I get validations errors for the fields when the view is first rendered. Coming from the JSF world it sounds a bit strange that they are called in this phase.
I tried extending BeanFieldGroup and move the validators away from the defaultValidators map and return them just before the commit but the map was private and using reflection would have been overkill. I also saw some hack with setting the validators in onblur-listeners but I wasn't too impressed with that approach either. How is this usually handled?
Thanks in advance,
I have worked around this partially by disabling/enabling validation at certain lifecycle point but it's still not pretty for such a common usecase.
Bean level validations and validation group-level checks would also be nice (and should not be difficult to implement)
For Vaadin Field components that edit @NotNull validated properties, you should always call setRequired(false). I though don't suggest to do this manually, but throw in Viritin and its improved form/databinding helpers. It will automatically do this for you, if you are for example using AbstractForm.
Viritin is also the only way I know to use bean level JSR-303 validators with Vaadin (without doing things manually). Here is a blog entry I wrote about cross field validation in Viritin.