CRUD Form instantly validating

When building a Crud<T> into a CustomField<List<T>> the crud form is always instant-validating.

Here is my example class, CustomListDataProvider is just a ListDataProvider supporting CrudFilter (also nerve-wracking):

public class CrudField<E extends AbstractEntity> extends CustomField<List<E>> {

    private final List<E> value;

    private final Crud<E> crud;

    private final CustomListDataProvider<E> dataProvider;

    public CrudField(Class<E> clazz, AbstractForm<E> form) {
        this.value = new ArrayList<>();

        this.dataProvider = new CustomListDataProvider<>(this.value);

        this.crud = new Crud<>(clazz, form.editor());
        this.crud.addDeleteListener(e -> this.value.remove(e.getItem()));
        this.crud.addSaveListener(e -> {


    protected List<E> generateModelValue() {
        return new ArrayList<>(this.value);

    protected void setPresentationValue(List<E> items) {


I don’t understand why you override the updateValue, I don’t think you should.

i removed updateValue and the value change listener and the problem still exists. I will adjust my example so it doesnt bring up wrong speculations. Anyways: Thats the way I make the CustomField bindable and notify about value changes (maybe there is a better way?)

generateModelValue should generate the model from the components
setPresentationValue should update the view (the components)
Here you are using one List as an attribute so the custom field doesn’t understand what is happening

notify about value changes
You should call updateValue() to notify the customfield that something has changed. For example in the addDeleteListener.
Then the customField will call generateModelValue and check if the old/new value is equals (You can override valueEquals and add a breakpoint)

and if it is not equals it will fire an valuechange event?


Very exciting, thank you! It would be nice to read something like that in the docs :smile:
But what does this have to do with the instant-validation of the BinderCrudEditor?

Probably nothing. I never used the crud component so I don’t know.

Maybe the instant-validation of the BinderCrudEditor is related to this: vaadin-custom-field-flow/vaadin-custom-field-flow/src/main/java/com/vaadin/flow/component/customfield/ at master · vaadin/vaadin-custom-field-flow · GitHub.

Okay :smile: Thanks alot for the information

This looks promising

(the custom field will call updateValue if the change event is called)
You can try to add a debug in updateValue(to see if it’s called too often

I did the following:

  1. Removed the addDataProviderListener
  2. Removed the fireEvent from updateValue
  3. Added updateValue to addSaveListener and addDeleteListener
  4. Added println to updateValue override to debug (the dirty way :s)

updateValue is not called initially (besides java, maybe in web)
and binding works like before. I didnt know about this mechanic, it should defenitly be added to the docs since its a nicer way of implementing value change

and the listener ist registered after the value change. so this should not be the problem

How should I proceed? Open an issue. Its obviously no programming error

Yes you can open an issue with a reproducible example on GitHub. ( or wait here if someone can answer you about the crud component)