0

I am currently working on a Customer Management application made in SmartGWT 2.0.

The Add Customer form is a fairly big one with multiple tabs and each tab has lot of fields. This form is opened in a modal window which have a save and a close button at the bottom.

Since this is a huge form, sometimes the rep accidentally hits Close without noticing that there is some information in one of the tabs.

We want to add some kind of alert when user tries to close the form after he has made changes to it.

I saw that there is ChangeHandler on text items which can flag a change which can be evaluated before firing the close event. However currently doing this for so many fields is a little bit cumbersome. Is there a way of achieving this on a DynamicForm level or even better on the Window level?

I am looking for a SmartGWT equivalent of this jquery code:

$("input:text, select, input:checkbox, input:radio, input:password").change(function(){
    unloadRoutineFlag = true;
});
skaffman
  • 398,947
  • 96
  • 818
  • 769
Shantanu Wagh
  • 1,011
  • 7
  • 13

1 Answers1

1

Take a closer look at this handler at the dynamicForm level.

addItemChangedHandler(ItemChangedHandler handler) 

Handler fired when there is a changed() event fired on a FormItem within this form.

Typically, when a formItem fires the changed() event, the form gets notified. Let us know if this works.

Jean-Michel Garcia
  • 2,359
  • 2
  • 23
  • 44
  • Sweet. Yes this worked for me. I am now having a central class where I can flag changes and later check it before closing the window. Thanks a lot Jean-Michel Garcia – Shantanu Wagh May 03 '12 at 21:30