1. #1
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    51
    Vote Rating
    0
    mark_l_lewis is on a distinguished road

      0  

    Default Ext.getCmp('form-id').submit()...

    Ext.getCmp('form-id').submit()...


    I've checked out dozens of posts (I know animal has linked several to his replies), but I just cannot get this to work. I've spent atleast 6 hours on this and I'm almost about to give-up :-(

    I have created a formpanel using an x-type. I've attached a reader and a couple of buttons and a few fields. Forms: loads data and renders it no probs. However, when I try and save the data get submit not defined. It's probable something very simple.
    ERROR: Ext.getCmp("my-details").submit is not a function

    HTML Code:
    var sf = {
    	 	title: 'My details',
    	 	closable: true,
    		id: 'my-details',
    	 	xtype: 'form',
    	 	defaultType: 'textfield',
    	 	bodyStyle:'padding:5px',
    		reader: memberReader,
    	 	items: personalDetails,
    	 	buttons: [{
     			text: 'Load',
    			handler: function (){
    				Ext.getCmp('my-details').load({url:'member_action.php?action=getMember', waitMsg:'Loading'});
    			}
     		}, {
    		
    			text: 'Save',
    			handler: function(){
    				Ext.getCmp('my-details').submit({
    					url: 'member_action.php?action=update',
    					failure: function(pd, action){
    						Ext.MessageBox.alert('Failed: ');
    					},
    					success: function(pd, action){
    						Ext.MessageBox.alert('Success: ');
    						
    					},
    					
    					waitMsg: 'Saving Data...'
    				});
    			}
    		}
    		]
     	 };
    Last edited by mark_l_lewis; 27 Jan 2008 at 2:16 PM. Reason: solved it forgot to put.getForm() in!

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,358
    Vote Rating
    127
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    FormPanel contains an instance of BasicForm. Retrieve the underlying BasicForm instance with getForm()

    Code:
     Ext.getCmp("my-details").getForm().submit();
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Ext JS Premium Member
    Join Date
    Jan 2008
    Posts
    51
    Vote Rating
    0
    mark_l_lewis is on a distinguished road

      0  

    Default


    Thanks Aaron. Works now.

    This stuff is very powerful, and once you get your head around it makes total sense. Just need to look at things differently

    Thanks again!

  4. #4
    Ext User
    Join Date
    Oct 2009
    Posts
    2
    Vote Rating
    0
    swadhina is on a distinguished road

      0  

    Default error

    error


    Ext.getCmp(PC.Form).getForm().findField(a).setValue(c); doesnt work...

Thread Participants: 2