TextField.getValue()

I’m slowly going crazy here. TextField.getValue() is not returning the data in the text field. I have the following snippet:


textfield = new TextField();
textfield.setImmediate(true);
textfield.setTextChangeEventMode(TextChangeEventMode.EAGER);
textfield.addTextChangeListener(new TextChangeListener() {
    public void textChange(final TextChangeEvent event) {
   	System.out.println("Text=" + event.getText() + "  TextField.getValue=" + textfield.getValue());
   	applyFilters();
    }
});

As I type in the textfield, I would expect the listener to output the text I typed in, but only the event.getText() returns the text, not the textfield.getValue(). That appears to be empty unless I take the focus away, then give it back and type something else (then the old text appears).

I’m using Vaadin 7.0.4. If I change the ChangeEventMode, the same thing happens

Any obvious reason this does not work?

Thanks

Simply : the value of the field is not changed until the field loses focus. The TextChange event is generated when the text changes. The ValueChange event is generated when the value changes. They are separate events for separate things.

Cheers,

Charles.

Got it. Thanks