Help with TextChangeListener

Hi friends,

i need help with the listener TextChangeListener

my problem is that the listener trigger before setting the TextField

this is my code

txtType.addTextChangeListener(new TextChangeListener() {

        public void textChange(TextChangeEvent event) {
            String s = txtType.getValue();

if i put “1” in my text field when debug S = “”

when put “12” in my text field when debug S=“1”

i need that the event trigger after setting update the TextField

Somebody have one idea?

thanks all

It’s a bit unintuitive, but TextChangeEvents don’t actually change the TextField (or TextArea) value. Only ValueChangeEvents (common to all Fields) do. The former are meant to get almost-realtime info about the client-side changes, before the changes are actually “committed” to the server side. Depending on your use case, you can either change your TextChangeListener to a ValueChangeListener, or get the current client-side value of the field via the event: TextChangeEvent.getText().