ComboBox value is always null

Hey, I’m using this binder in a form for a combobox:

        // Headend
        ComboBox<Headend> headend = new ComboBox<>(getTranslation("authority.headend"));
        headend.setItemLabelGenerator(Headend::getName);
        headend.setItems(headendService.dataProvider());
        this.binder.forField(headend)
                .asRequired(getTranslation("form.error.required"))
                .withValidator(value -> authorityService.isHeadendAndCodeUnique(value, code.getValue(), id.getValue()), getTranslation("authority.headend.unique"))
                .bind(Authority::getHeadend, Authority::setHeadend);
        add(headend, 3);

Now in anothers binder value change listener, I wanna check the value of the headend binder. Sadly this always returns null:

pricing.addValueChangeListener(event -> {
           System.out.println(headend.getValue());
 });

What am I doing wrong? The selection in the frontend works and it shows the correct data even after saved an reloaded

The value change listener is only called with the object on save but not on editing itself.

Are you sure you adding the listener to the right field? pricing does not look like headend to me

Yeah it’s correct like this. If pricing changes, I need to check the current headend value to set even another binder to required on a specific state combination

Well… then it seems totally fine… getValue should be available if it was selected correctly (hash code / equals okay) other then that I’ve never heard of such a problem before

First I thought its null every time but the value change listener is called with the correct object, but only on save as I said. While just clicking through the form it’s always null

I would highly suggest to create a minimal example… there you can probably it see that it works :grimacing: it must be something in your code

You’re not setting an initial value in the ComboBox?

I am, sorry it’s just outside the provided code. It works through a Crud which then opens the form and sets the initial values from the selected bean

And it does all works through frontend and backend, even saving. Just setting the required dynamically now has problems