PDA

View Full Version : xtype: textfield



crazy
10 Oct 2009, 12:58 AM
can anyone say how can i get values from these fields....



var details1 = new Ext.form.FormPanel({
autoHeight: true,
labelWidth: 200,
monitorValid:true,
items:[
{
xtype: 'textfield',
fieldLabel: 'First Name',
name:'FirstName',
width:190,
allowBlank: false
},
{
xtype: 'textfield',
fieldLabel: 'Last Name',
name:'LastName',
width:190
},
{
xtype: 'radio',
fieldLabel: 'Sex',
name: 'Gender',
boxLabel: 'male'
},
{
xtype: 'radio',
hideLabel: false,
name: 'Gender',
boxLabel: 'female'
},
{
xtype: 'datefield',
name: 'Dob',
fieldLabel: 'Date of Birth',
width:190}
]
});



thanks
cRaZy

Animal
10 Oct 2009, 1:00 AM
details1.getForm().getValues() ?

crazy
10 Oct 2009, 1:15 AM
no man
its not giving the values.
i tried

alert(details1.getForm().getValues('FirstName'));


but its giving o/p as [Object Object]

Condor
10 Oct 2009, 2:51 AM
It's:

alert(details1.getForm().getValues()['FirstName']);
or

alert(details1.getForm().findField('FirstName').getValue());

crazy
10 Oct 2009, 3:37 AM
thanks condor

Animal
10 Oct 2009, 6:00 AM
no man
its not giving the values.
i tried

alert(details1.getForm().getValues('FirstName'));


but its giving o/p as [Object Object]

Yes "man"

Did you even examine what the code returned, or look at the API docs for the suggested calls to maybe perhaps learn about what I suggested.

Or did you just wait until someone gave you an incantation which you use in this one case, learn nothing and ask the same question again?

nickweavers
11 Oct 2009, 3:42 AM
It's:

alert(details1.getForm().getValues()['FirstName']);
or

alert(details1.getForm().findField('FirstName').getValue());

@condor, thanks for that. It is easy to forget that variables in javascript can act as namespaces when you are new to it, or returning after a while away from it.

@animal, where do you get off! Was that really necessary? We all sometimes have problems seeing the wood for the trees with this stuff. Pretty unreasonable to judge people like that, then castigate them in public and on top of it mock their style of speech.
We should not be put in fear of humiliation when asking questions here!