parttio / textfieldformatter

TextField Formatter Vaadin add-on
Apache License 2.0
13 stars 9 forks source link

Wrong value after blur event #6

Open pedjapesic opened 7 years ago

pedjapesic commented 7 years ago

I believe that this addon has some problem with blur event. I noticed that if you use blur event to get value of the TextField the most of the time it will return wrong value. It's very simple to reproduce it:

TextField tf1 = new TextField(); new NumeralFieldFormatter(tf1, ",", ".", -1, 2, false); addComponent(tf1);

tf1.addBlurListener(new BlurListener() { @Override public void blur(BlurEvent event) { System.out.println("tf1 = " + tf1.getValue()); } });

When you type first value e.g. "5", after blur you will get "", when you continue to change it and observe the result, sometimes you get correct value, sometimes you get previous value meaning sometimes value will be stored before blur, sometimes after.

When you do not use NumeralFieldFormatter, blur event always returns correct value (value has been stored before blur event) and whatever you type it will be printed correctly.

Tested with Vaadin 8.0.6