PDA

View Full Version : setting form field values



adeelmahmood
12 Nov 2010, 12:32 PM
is there a way to set the value of form fields .. i have tried

Ext.select('#field1,#field2,#field3').set('');

doesnt seems to do anything ..

darthwes
12 Nov 2010, 2:54 PM
Look into form.BasicForm (http://dev.sencha.com/deploy/dev/docs/source/BasicForm.html#method-Ext.form.BasicForm-setValues) and form.Field (http://dev.sencha.com/deploy/dev/docs/source/Field.html#method-Ext.form.Field-setValue) set value calls?

adeelmahmood
12 Nov 2010, 4:35 PM
how do i get the Field object though .. If I do a Ext.get(id) .. I get a Element object back and if I go with Ext.getCmp .. I am assuming I get TextField object back .. how do I get the Field object

secondly to get the BasicForm object .. I have my form showing up in a window .. with form layout

var wnd = new Ext.Window({
...
layout: 'form',
items: [{
xtype: 'textfield'
...
}]
})

i tried wnd.getForm and that doesnt returns me anything .. I know i can use the getForm function on a FormPanel but how do I get it in my case .. where form is embedded inside a window instead of FormPanel.

Lastly one more question .. If I want to override some of the events .. can i simply specify them in the json object params for xtype(textfield) item

{
xtype: 'textfield',
blur: function(){ ... }
}

thanks for ur help