I have a required TextField and set it up like this:
TextField title = new TextField("Title");
title.setRequired(true);
The validation works as expected. An empty field will get invalid
state and turns red.
As soon as I use a Binder for this, the validation is not visible to the user anymore:
Binder<Dto> binder = new Binder<>(Dto.class);
binder.bindInstanceFields(this);
binder.setBean(dto);
Leaving the field, the validator runs and calls the com.vaadin.flow.component.shared.HasValidationProperties#setInvalid(true).
But then the binder kicks in and overwrites to false here com.vaadin.flow.data.binder.Binder#clearError.
Although, the field is empty, when calling binder.validate();
it does not show any errors.
What is the intention of the binder overwriting the validation?
How can I have the default behaviour of field turning red on empty input?
Why is binder.validate().isOk() == true
although my field is empty?
Thank you.
References: