I have a Texfield that is binded to a property bean with a binder with asRequired method.
I saw the required indicator even though i set the requiredIndicatorVisible to false in the textField. Why?
Textfield name = new Textfield("name");
name.setRequiredIndicatorVisible(false);
Binder<Person> binder = new Binder<>();
binder.forField(name)
.asRequired("You must write a name")
.bind(Person::getName,Person::setName);
Hi,
it’s by design. Here is an extract from javadocs of BindingBuilder interface
Sets the field to be required. This means two things:
[b]
1. the required indicator will be displayed for this field
[/b]
2. the field value is validated for not being empty, i.e. that the field's value is not equal to what HasValue.getEmptyValue() returns
If you want to hide the indicator move name.setRequiredIndicatorVisible(false) after the binding code.