PDA

View Full Version : Accessing a form created using xtype, from a button



adibhagra
30 Sep 2009, 3:49 AM
hey all,

i have a form that i am using within my panel , i have used xtype in order to create this form, i wish to now submit this form via button,but since i dont have a variable to which my form is assigned i cant use var_name.getForm().submit(), can someone please tell me what i can do now . my code is as follows:


items:[{


xtype:'form',
url:'/kohana/index.php/manage/get_violations' (http://www.extjs.com/forum/'/kohana/index.php/manage/get_violations'),
title:'Reporting',
height:300,
anchor:'100%',
bodyStyle:'padding:5px;',
defaultType:'textfield',

items:[{
xtype:'combo',
name:'site',
fieldLabel:'Site',
store: store,
displayField:'site',
mode:'local',
width:94

},
{
xtype:'datefield',
fieldLabel:'Start Date',
name:'sdate'
},{
xtype:'datefield',
fieldLabel:'End Date',
name:'edate'
},{
xtype:'combo',
name:'show_violations',
mode:'local',
store:new Ext.data.SimpleStore({
fields:['violations'],
data:[['Completed'],['In Progress'],['All']]
}),
displayField:'violations',
width:94,
fieldLabel:'Violations'

},
{
xtype:'button',
text:'Submit',
handlers:function(){
// want to submit my form from here
// how do i access this form
}
}]


thanks and regards,

ice

jay@moduscreate.com
30 Sep 2009, 4:16 AM
you can use itemId, look at the API for Ext.Container

adibhagra
30 Sep 2009, 5:47 AM
i tried this , here 'myForm' is my itemId , but i get the error on firebug saying that Ext.getComponent is not a function. i tried even Ext.FormPanel.getComponent('myForm') but even then its the same response. can you please mention how to use getCompoent.

{
xtype:'button',
text:'Submit',
handler:function(){
console.info('hi');
Ext.getComponent('myForm').submit({
success:function(f,a){
Ext.Msg.alert('Thanks','Finally');
}
})
}

thanks and regards,

ice

jay@moduscreate.com
1 Oct 2009, 10:28 AM
Ext.getCmp

adibhagra
4 Oct 2009, 10:50 PM
hey ,

i tried out Ext.getCmp , but even then it doesn t work.(it says Ext.getCmp is undefined)

any idea what should be done now,

regards,

ice

jay@moduscreate.com
5 Oct 2009, 4:04 AM
That's impossible. Are you using Ext 1.x?

adibhagra
5 Oct 2009, 9:07 AM
yeah, thanks .

jay@moduscreate.com
5 Oct 2009, 9:17 AM
Well, you're posting in a version 3.0 forum!

That said, xtypes are not supported in 1.x