ExtJs check if form values has changed
is there a possibility to check if 开发者_JAVA技巧form values has changed in ExtJs?
Thanks
myForm.getForm().items.each(function(field){field.on('change',function(f,n,o){alert('detected! '+f.label+' value changed from '+o+' to '+n);});});
In the above snippet, what you are basically doing is -
- Iterate over all fields in the form (
myForm.getForm().items.each()
) - For each field, add a change listener. (
field.on(...)
) - When a field's value is changed, the listener will be invoked with the field info and old and new value.
- In the listener, change the alert with the appropriate logic.
精彩评论