I have a TextField
and add validation by field.addValidator(validator)
.
I want to use the field both for editing an entity, as well as creating a new one.
Problem: when creating a new one, I would like to have more validators applied then when editing. Eg: creating an Account would require a UniqueAccountValidator
added to the textfield.
But then, when I editing the account (with the same form), I'd like to skip only the UniqueAccountValidator
as the object is not be be created new, but merged.
Is is possible to somehow tell a vaadin BeanFieldGroup
or an AbstractField
to skip certain validators in specific cases?