tags:

views:

467

answers:

1

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");
      }
   };
}
A: 

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

    }
});
Igor Klimer