TextField textField = new TextField("Vaadin 8");
Binder<Person> binder = new BeanValidationBinder<>(); // Binder class does not add JSR validation, you should use BeanValidationBinder
binder.setBean(person);
binder.forField(textField)
.withValidator(new StringLengthValidator("Too short", 8, 256)).bind("name"); // bind with person::getName ,Person::setName does not add JSR validation
validationForm.addComponent(textField);
You should try this add-on (easybinder but i didn’t try it) if you want to use bean validation binder for a vaadin application because Vaadin bean validation binder is incomplete.
“Vaadin bean validation binder is incomplete”. really? yes that code it’s work but my rule in class not work. example : if i type 14 character in text field, the text field not show the notification.
Vaadin bean validation has no cross field validation (for me this is the main problem), and don’t validate property if it’s bind with getter and setter. It can work with setBean but it “can’t work immediatly” with readBean/writeBean (for cross validation).
Problems are listed oin the Readme of the addon EasyBinder.
The validation is working or not ? I don’t understand (if the validation is not working then the code is not working )