PDA

View Full Version : How to get value in formPanel using its ID ?



yagi
28 Jul 2010, 11:01 PM
Hi All..,

Is it possible to get values in formPanel using / based on its ID?

so, I'm using :


var id = new newhid.core.rating.form().getId();
getCmp(id).getValue(); // is it possible to do this to get the value?


Or there is another way, to get the form values using its ID?

Thanks..

Condor
29 Jul 2010, 1:09 AM
Is it the FormPanel or the Field that has the id?

var values = Ext.getCmp('id-of-formPanel').getForm().getFieldValues();
var value = Ext.getCmp('id-of-field').getValue();
var value = Ext.getCmp('id-of-formPanel').getForm().findField('name-of-field').getValue();

yagi
29 Jul 2010, 1:25 AM
Hi Condor..

Thanks for your reply..
The ID belongs to formPanel, and I want to use this ID for getting all values in it.

I've tried to use this :


var values = Ext.getCmp('id-of-formPanel').getForm().getFieldValues();
Here is my code :


var a = new newhid.core.vims_comp_group.form().getId();
var values = Ext.getCmp(a).getForm().getFieldValues();
console.log(values);
But it shows error like this in firebug :
Ext.getCmp(a).getForm().getFieldValues is not a function

What am I missing?

Condor
29 Jul 2010, 3:05 AM
Older Ext versions didn't have a getFieldValues method. On these versions you will have to use getValues().

The drawback of using getValues() is that you get the string values, even from number and date fields.