getting value from TextField

Hello,
I’m trying to figure out what is the difference between two methods of getting value from TextField:

  1. textField.getValue()
  2. from event.getText() of TextChangeListener

method 2 work fine and fast, however method 1 returns value only if I click on some button on the layout.

P.S.
code is in the attachments

30202.java (2.24 KB)

TextChangeEvent occurs when you type or otherwise change the text (copy/paste). The text is the “raw” contents in the ui, not formatted or validated at this point. The field’s value change usually happens when you exit the field (click outside the field, tab out, etc.). If you get the value from the field’s getValue or ValueChangeEvent, it has been formatted and validated.

-Olli