msaif
msaif

Reputation: 71

gwt textbox add change handler

i have a textbox received from designer.but i wrote action in GWT. the problem is textbox is empty but when textbox is filled by value by pressing button then alert box will be displayed informed that value has been changed. but not worked.help me.

  TextBox zip1 = null;

  function onModuleLoad() {
    zip1 = TextBox.wrap(DOM.getElementById("zip1"));
    zip1.addChangeHandler(zip1ChangeAction());
 }

private ChangeHandler zip1ChangeAction() {
   return new ChangeHandler() {
      public void onChange(ChangeEvent event) {
         Window.alert("change fired");
      }
   };
}

Upvotes: 7

Views: 18571

Answers (1)

Igor Klimer
Igor Klimer

Reputation: 15331

It seems that what you want is ValueChangeHandler:

textBox.addValueChangeHandler(new ValueChangeHandler<String>() {
    @Override
    public void onValueChange(ValueChangeEvent<String> event) {
        // TODO Auto-generated method stub

    }
});

Upvotes: 14

Related Questions