Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
BeanFieldGroup not modified aufter TextField change
Hello,
I have a BeanFieldGroup that binds a BeanItem to a CustomComponent with a TextField.
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.TextField;
import com.vaadin.data.util.BeanItem;
import com.vaadin.event.FieldEvents.TextChangeEvent;
public class PriorityEditor extends CustomComponent {
@PropertyId("severity")
private TextField severityTextField = new TextField();
private Button saveButton = new Button();
private BeanFieldGroup<?> bindFieldsBuffered = new BeanFieldGroup<>(Priority.class);
public void edit(BeanItem<Priority> priorityItem) {
severityTextField.addTextChangeListener(this::textChange);
bindFieldsBuffered.setBuffered(true);
bindFieldsBuffered.setItemDataSource(priorityItem);
bindFieldsBuffered.bindMemberFields(this);
}
private void textChange(TextChangeEvent event) {
if (bindFieldsBuffered.isModified()) //is not modified
saveButton.setEnabled(true);
else
saveButton.setEnabled(false);
}
....
}
Now if I select my severityTextField and press a key on the keyboard I do get a TextChangeEvent but bindFieldsBuffered.isModified() returns false. Now if I put a second character I get a second TextChangeEvent and bindFieldsBuffered.isModified() returns true. However I'd like to get true the first time around. Is this a bug or should I use another listener?
Hi,
Have you tried to change your text field to immediate?
severityTextField.setImmediate(true)
I tiried that, didn't help.
The value of the text field does not change when a character is typed in the text field. I think the value is set when the text field looses focus the bindFieldsBuffered returns isModified=true when the value of any field is changed.
Anyway I can get the new text that i typed with event.getText(). I'd find it better if I could decide if the typed text is set as value immediately or after focus out...
I didn't find any setter for other properties that could influence thah behaviour.