AbstractField.setRequired() does not update the field?

Using Vaadin 7.0.6, we’ve got a ComboBox (“slave”) which needs to be set as required based on the value of another combo (“master”), so we go like this:

    master.addValueChangeListener(new ValueChangeListener() {
       public void valueChange(ValueChangeEvent event) {
         boolean required = <... compute if required from current value ...>

however, while the field effectively becomes required (i.e. if you commit the form with an empty combo, you get the exception), no red asterisk appears next to the field. Both comboboxes have setImmediate(true) and setValidationVisible(true). When committing the form, the asterisk appears; but we need it immediately!

Seeing that AbstractField.setRequired() does not call markAsDirty(), we tried adding slave.markAsDirty() after setRequired but this does not seem to work either.

Is this by design? A bug? We need to show that the field is required as soon as possible to the user.

did you set the slave to immediate?


That normally fixes this

yes, as stated in the first post.