1. #1
    Sencha User Phunky's Avatar
    Join Date
    Jun 2007
    Location
    West Yorkshire
    Posts
    341
    Vote Rating
    0
    Phunky is on a distinguished road

      0  

    Default [HELP] Setting Form Values Dynamicly

    [HELP] Setting Form Values Dynamicly


    I know this questions most likely been answered 1000+ times already but i cant seem to find anything about it through the forum search.

    I have a simple form and wish to change the values of the element when a certain action is triggered.

    Now if i have the following

    Code:
    new Ext.form.FormPanel({
    	id: 'form',
    	title: 'Form Test',
    	items: [{
    		xtype:'fieldset',
    		title: 'Partner Details',
    		collapsible: true,
    		autoHeight:true,
    		defaults: {width:250},
    		defaultType: 'textfield',
    		items :[{
    			fieldLabel: 'Name',
    			disabled: true
    		},{
    			fieldLabel: 'Email',
    			name: 'email'
    		}]
    	}]
    });
    How would i reference Name and Email to set the values? should i really set and ID for both of them so that i can use Ext.getCmp()? or is there a better/simpler way??

    Sorry for such a simple question - i know it terrible, you would have thought i would have caught on by now!

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    96
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Use:

    Code:
    Ext.getCmp('form').getForm().findField('email').setValue('name@server.com');

  3. #3
    Sencha User Phunky's Avatar
    Join Date
    Jun 2007
    Location
    West Yorkshire
    Posts
    341
    Vote Rating
    0
    Phunky is on a distinguished road

      0  

    Default


    Aha i thought that the would be some nice way of getting fields!

    Thanks, once again Condor saves the day for me think your going to need a donate button soon!

Thread Participants: 1