TextField valuechangelistener behaves abnormally


I add value change listener, using addValueChangeListener, to a TextField, and I found that the listener was invoked when every key was pressed, instead of a complete value change. Even I set the value change mode to ON_CHANGE, it still behaved abnormally. This failure happens both in v11 and v12. Please kindly advise.

Best regards,

As far as I know all the modes work correctly.

The behaviour of the different modes is the following:

EAGER: Syncs the value to the server each time it’s changed on the client. The event that triggers the synchronization is defined by the component.

ON_CHANGE: Syncs the value to the server on change event, i.e. when the component value is committed.

ON_BLUR: Syncs the value to the server on blur event, i.e. when the component looses focus.

You can try the following code to compare the differences between the different modes:

TextField textField1 = new TextField("Eager");
textField1.addValueChangeListener(event -> {

TextField textField2 = new TextField("On change");
textField2.addValueChangeListener(event -> {

TextField textField3 = new TextField("On blur");
textField3.addValueChangeListener(event -> {

add(textField1,textField2, textField3);