PDA

View Full Version : applyIfToFields not working



nadeemshafi9
22 Jun 2009, 3:25 AM
Hi guys

i would like to put a * infront any tab containing a form which has been altered, i have tried a few different events but i dont think the listener itself is being applyed here is what i have done, i have tabs that are opened when you click on the grid row a new tab opens with the name dynamicaly generated for its form and everything.




Ext.getCmp('updateUserFormPanel_manageusers_'+m[0].data.id).getForm().applyIfToFields({
listeners: {
focus: function() {
alert('hello');
}
}
});


it dosent seem to be throwing any errors anymore it just dosent do what its supposed to.

i define the form and then after i do this


thanks

evant
22 Jun 2009, 3:34 AM
You're just applying an object literal, that's useless if the field has already been created. Listeners are only read at initComponent time.

nadeemshafi9
22 Jun 2009, 3:36 AM
thanks, when do you sugest i apply the config to each, oir should i re-initialise the form somhow ?

evant
22 Jun 2009, 3:38 AM
Before they are created...

nadeemshafi9
22 Jun 2009, 3:48 AM
Before they are created...


sorry but my problem now is that i cant find an event that fires before any elemsnts are created in teh form. Am i going teh right way ?

nadeemshafi9
22 Jun 2009, 4:07 AM
i am creating the form using xtype and lazy def


........
xtype: 'form',
columnWidth: 1,
id: 'updateUserFormPanel_manageusers_'+m[0].data.id,
border: false,
bodyStyle : 'padding:10px 10px 10px 10px;',
listeners: {
beforerender: function(){
Ext.getCmp('updateUserFormPanel_manageusers_'+m[0].data.id).getForm().applyIfToFields({
change: function(){
alert('hello');
}
});
}
},
items: [{
xtype: 'hidden',
name: 'id',
value: m[0].data.id
},{
xtype: 'textfield',
allowBlank: false,
name: 'friendly_name',
emptyText: 'Friendly Name',
fieldLabel: 'Friendly Name',
value: m[0].data.friendly_name........

nadeemshafi9
22 Jun 2009, 4:12 AM
........
xtype: 'form',
columnWidth: 1,
id: 'updateUserFormPanel_manageusers_'+m[0].data.id,
border: false,
bodyStyle : 'padding:10px 10px 10px 10px;',
listeners: {
beforerender: function(){
Ext.getCmp('updateUserFormPanel_manageusers_'+m[0].data.id).getForm().applyIfToFields({
change: function(){
alert('hello');
}
});
}
},
items: [{
xtype: 'hidden',
name: 'id',
value: m[0].data.id
},{
xtype: 'textfield',
allowBlank: false,
name: 'friendly_name',
emptyText: 'Friendly Name',
fieldLabel: 'Friendly Name',
value: m[0].data.friendly_name........