Any chance to only validate BeanFieldGroup fields on commit()?

I have a couple of form fields grouped into a BeanFieldGroup. The bean backing the form is annotated with JSR-303 annotations. The field group (appropriately) creates field validators based on bean annotations. The field group’s “buffered” attribute is set to true. However, contrary to what the documentation states, the form fields are validated immediately on setting the itemDataSource, not only when commit() is called. This leads to an ugly display of new empty forms - all blank fields have red exclamation marks, even before the user had a chance to input something :-(.

Is there a more elegant solution other than manually creating validators before commit() and removing them immediately after? I’m bashing my head against a wall here, so any help would be really appreciated!

Yeah, this is IMHO somewhat of a defect in Vaadin Fields. The validation cannot be easily disabled, but the validation errors can be hidden, by calling setValidationVisible(false) for each field. The old Form did this automatically, but FieldGroup doesn’t. There’s a
ticket
about it.

However, I think all fields should really have an “unbound” state where no validation is performed - validation should be done only after the client has submitted something at least once.

Yeah, this is kind of a weird behavior… Why validate anything before the user actually had a chance to input something? Well, here’s hope it will be changed in a future release…