-
11 Oct 2012 10:39 AM #1
Answered: Adding a Listener to a Fieldset for field changes
Answered: Adding a Listener to a Fieldset for field changes
I have a fieldset in a form panel with several fields of different types and I want to fire a function when any field is changed. The change listener event is fine for an individual field, but rather that having to put a listener on every single field, is there a listener I can put on the fieldset or the form that fires when any field changes? I tried the updatedata event for the form but that is't doing it.
-
Best Answer Posted by scottmartin
You can use the following:
ScottCode:Ext.create('Ext.form.Panel', { title: 'Simple Form', bodyPadding: 5, width: 350, layout: 'anchor', defaults: { anchor: '100%' }, // The fields defaultType: 'textfield', items: [{ fieldLabel: 'First Name', name: 'first', allowBlank: false },{ fieldLabel: 'Last Name', name: 'last', allowBlank: false }], defaults: { listeners: { change: function(field, newVal, oldVal) { console.log('change'); } }, }, renderTo: Ext.getBody() });
-
12 Oct 2012 5:07 AM #2Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
You can use the following:
ScottCode:Ext.create('Ext.form.Panel', { title: 'Simple Form', bodyPadding: 5, width: 350, layout: 'anchor', defaults: { anchor: '100%' }, // The fields defaultType: 'textfield', items: [{ fieldLabel: 'First Name', name: 'first', allowBlank: false },{ fieldLabel: 'Last Name', name: 'last', allowBlank: false }], defaults: { listeners: { change: function(field, newVal, oldVal) { console.log('change'); } }, }, renderTo: Ext.getBody() });
-
12 Oct 2012 1:21 PM #3


Reply With Quote