1. #1
    Ext User
    Join Date
    Sep 2009
    Posts
    74
    Vote Rating
    0
    adibhagra is on a distinguished road

      0  

    Default Accessing a form created using xtype, from a button

    Accessing a form created using xtype, from a button


    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',
    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
    Last edited by adibhagra; 5 Oct 2009 at 2:35 AM. Reason: For sake of clarity

  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    you can use itemId, look at the API for Ext.Container

  3. #3
    Ext User
    Join Date
    Sep 2009
    Posts
    74
    Vote Rating
    0
    adibhagra is on a distinguished road

      0  

    Default using itemId

    using itemId


    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

  4. #4
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Ext.getCmp

  5. #5
    Ext User
    Join Date
    Sep 2009
    Posts
    74
    Vote Rating
    0
    adibhagra is on a distinguished road

      0  

    Default Ext.getCmp("myForm") is undefined

    Ext.getCmp("myForm") is undefined


    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

  6. #6
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    That's impossible. Are you using Ext 1.x?

  7. #7
    Ext User
    Join Date
    Sep 2009
    Posts
    74
    Vote Rating
    0
    adibhagra is on a distinguished road

      0  

    Default Thanks

    Thanks


    yeah, thanks .

  8. #8
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Well, you're posting in a version 3.0 forum!

    That said, xtypes are not supported in 1.x

Thread Participants: 1