Skip to content

Instantly share code, notes, and snippets.

@chrisdiana
Last active October 4, 2022 22:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save chrisdiana/8d7985e9b06dfbb792a8 to your computer and use it in GitHub Desktop.
Save chrisdiana/8d7985e9b06dfbb792a8 to your computer and use it in GitHub Desktop.
Detect field change in ExtJS
var panel = new Ext.form.FormPanel({
title: 'Example',
width: 350,
items: [],
listeners: {
add: function(me, component, index) {
component.on('change', function(f,n,o) {
alert('detected! '+f.label+' value changed from '+o+' to '+n);
console.log(component.startValue);
});
}
}
});
// example on render or load
example.form.load({
url: '/my/api',
params: {id: 5},
success: function(result, request) {
var form = example.getForm();
form.items.each(function(field){
field.on('change',function(f,n,o){
alert('detected! '+f.label+' value changed from '+o+' to '+n);
});
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment