When using 'SetValues' for form elements, an object array with id, value pairs is required similar to :
myform = new Ext.form.Form({ labelWidth : 75 }); myform.add ( new Ext.form.TextArea({ fieldLabel : 'label for box 1', name : 'myfield1', height : 50 }) ); myform.setValues([ { id : 'myfield1', value : '123' }, { id : 'myfield2', value : '456' } ]);
If you simply want to access the value of an items field from a buttons handler, you can use the following code:
var myform = new Ext.BasicForm({ defaultType: 'textfield', items:[{ fieldLabel: 'Search', name: 'search', allowBlank:false }], buttons:[{ text: 'Search', handler : function(){ alert(this.ownerCt.getForm().findField('search').getValue()); } }] }