PDA

View Full Version : TextField onChange error



zdarsky
16 Jul 2009, 10:38 PM
Hi,

Is there a way how to get event onchange for a TextField.

I'd like to receive an event everytime the value in a textfield changes. (even while typing)

TextField<String> nameField = new TextField<String>();
nameField.setFireChangeEventOnSetValue(true);nameField.setAllowBlank(false);
nameField.setAutoValidate(true);
nameField.setValue(questformBO.getQformname());
nameField.setFieldLabel(i18nConstants.name());
nameField.addListener(Events.Change, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
System.out.println(be.getType());
QuestionaireDetailPanel.this.setText(be.toString());
}});
nameField.addListener(Events.OnChange, new Listener<BaseEvent>() {
@Override
public void handleEvent(BaseEvent be) {
System.out.println(be.getType());
QuestionaireDetailPanel.this.setText(be.toString());
}});

What is wrong?

best regards,
Martin Zdarsky