Looks like binder only writes back values when none of the bindings have validation errors.
This sounds like “buffered” mode in old vaadin.
What do I need to do to get the “unbuffered” behavior?
I want to be able to ask the binder if all fields are valid
I want invalid fields to be red
I want a valid field to call its binding’s setter immediately. It should not be blocked by another invalid field
@quirky-zebra Not sure I understand. I’m not talking about the annoying “write back” that vaadin does when you bind a field initially. I’m talking about changes the user does when using the application.
As soon as one field is invalid, the binder stops writing back changes in any other fields as well.
@vital-koala , I could use writeBeanAsDraft if this was something I wanted on a submit button, but I want values from all fields to write back changes to the bean as they happen.
binder.setBean(row);
var someDate = new DatePicker("Some Date");
binder.forField(someDate).bind(Row::getSomeDate, Row::setSomeDate);
add(someDate);
var someText = new TextField("Last Name");
binder.forField(someText).bind(Row::getSomeText, Row::setSomeText);
add(someText);
If I write “x” in the DatePicker, changes in the TextField are not written to Row.
When I remove the “x” in the DatePicker, all changes are written to Row
You can call writeBeanAsDraft manually if you want potentially invalid values in your bean.
The idea behind both setBean and writeBean is that binder should protect the bean so that it only ever sees a valid set of values