PDA

View Full Version : how to reset form values



venkatadineshp
26 Jul 2011, 8:26 AM
Hi,
I working on application, In which I have to reset the contents of a form. I could not figure out how to access FormPanel from toolbar and reset the select fields in the formpanel.

Here is the code


Trial.views.HomeToolBar = new Ext.Toolbar({
id : 'HomeToolbar',
title : 'Welcome'
});

Trial.views.HomeBottomBar = new Ext.Toolbar({
id : 'HomeBottomBar',
dock:'bottom',
layout : 'hbox',
items : [{
text : 'Reset',
ui : 'action',
handler : function() {
????
}
},{
xtype : 'spacer'
}]

});

Trial.views.Home = new Ext.extend(Ext.Panel, {
id : 'homePanel',
scroll : 'vertical',
dockedItems : [ Trial.views.HomeToolBar , Trial.views.HomeBottomBar],
items : [ {
xtype : 'OriginForm'
}, {
xtype : 'DestinationForm'
}, {
xtype : 'LoadInfoForm'
} ]
});
Ext.reg('HomePanel', Trial.views.Home);

Original form, DestinationForm, LoadInfoForm are of type formpanel which has select fields in them.

Can any one please tell how to get access to other component.

Thanks

jjerome
26 Jul 2011, 8:35 AM
use Ext.getCmp(id).setValue(value);

id - the id config option of the component
value - the value you want to set the fields

venkatadineshp
26 Jul 2011, 9:25 AM
Thanks it worked.

jjerome
26 Jul 2011, 10:01 AM
Great :) Glad I could help