Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Propagation of validation errors to CustomField
Hello,
I'm currently moving to vaadin 8.0.5. I have a CustomField which I bind to some method and a validator.
The problem is now, that I do not understand how to catch the validation errors and show them on my field, see the following snippet:
class Bean {
String name;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}
class TestField extends CustomField<String> {
TextField field = new TextField();
@Override protected Component initContent() { return field; }
@Override protected void doSetValue(String s) { field.setValue(s); }
@Override public String getValue() { return field.getValue(); }
}
TextField field = new TextField();
TestField custom_field = new TestField();
new Binder<Bean>().forField(field)
.withValidator(s -> false, "this error is visible")
.bind(Bean::getName,Bean::setName);
new Binder<Bean>().forField(custom_field)
.withValidator(s -> false, "this error is not visible")
.bind(Bean::getName,Bean::setName);
The standard TextField just displays the validation error as expected, the CustomField however shows no error indicator...
What am I missing?
Thank you very much!
Edit: So, i've found the 'ValidationStatusHandler', but this does not trigger.... weird...
new Binder<Bean>().forField(custom_field)
.withValidator(s -> false, "this error is not visible")
.withValidationStatusHandler(System.err::println)
.bind(Bean::getName,Bean::setName);
Edit: Since I did not get a response here, I've created a bug report: https://github.com/vaadin/framework/issues/9278
Meanwhile, I think I've found the missing peace. Overwriting the following methods did the trick:
@Override
public void setComponentError(ErrorMessage componentError) {
super.setComponentError(componentError);
field.setComponentError(componentError);
}
@Override
public Registration addValueChangeListener(ValueChangeListener<String> listener) {
return field.addValueChangeListener(listener);
}