Write invalid form field values to a business object

Hello,

I would like to know is there any solution to write the field values to a business object if any of the bound fields has an invalid value?

My Binder have a bean (I used setBean() method) and fields have validators.

Validators prevents writing invalid values and that is problem for my use case.

In official documentation I don’t see that is possible.
In Vaadin 7 we had method setInvalidCommitted(boolean isCommitted) on Field object for that purpose.

Thank you in advance for your help.

Dragan Radevic

Validators prevents writing invalid values and that is problem for my use case.

That is the very purpose of the Validators and Binder.

If you have a case where you really want and need to update business object with non-validated values, the most typical way is not to use Binder. I.e. then you could just use value change listeners in the fields, etc.

Hello Tatu,

Thank you for your reply, but I think that you’re not completelly right.

Validator purpose can also be to check values and to warn user. Not only to prevent writting.

Binder purpose is also to adapt values for field, especially usefull when you have a complex business object (not pojo).

Solution without binder and validators can not be good enough, that version will have a lot of hard coded things.

Dragan Radevic