how to use formBinder and Vaadin Bean Validation together

hello vaadiners

Is it possible to use FormBinder addon and Vaadin Bean Validation addon together ? (or atleast FormBinder addon with one of the Bean Validation API implementations)

  • I would like to use FormBinder to layout forms the way I want
  • And I would like to use the Bean Validation API ( ideally with the Vaadin Bean Validation addon) to validate bean properties using simple validation annotations

So How can I use these 2 addons together?

Or if it is not possible (because both addons extends the Vaadin Form class, and my custom form class can not have 2 parent classes , just only one)

Then what would be the closest solution to my needs?

Thanks for your answer :slight_smile:

Hi,

I think it should be rather easy to add support for BeanValidation add-on to FormBinder. BeanValidationValidator class has a static method that practically does the magic in BeanValidationForm.
See here.

PreCreatedFieldHelper
would be the “right place” to build the support, but a quick and dirty solution would be to override attachField of your form and configure validator there if one does not exist.

If you decide to build support right into FormBinder, please post me the patch and I’m happy to commit it.

cheers,
matti