maybie without declare each component ui
just declare once
@nifty-tasmanian have you checked out the bean validator API? https://vaadin.com/blog/introduction-to-java-bean-validation
the tutorial should have Form Layout sir, but i dont have that
the constraintviolation objects should have enough information for you to set the appropriate condition on your field objects
so that, we need FormLayout for making validation sir?
val validation = registrationBinder.validate();
if (validation.isOk()) {
} else {
validation
.getFieldValidationErrors()
.forEach(
error -> {
val field = error.getField();
if (field instanceof HasValidation hv) {
error.getMessage().ifPresent(hv::setErrorMessage);
}
});
}
You don’t need a form layout–all of your fields should implement HasValidation and you can just use something like that ^^ to set the messages