PDA

View Full Version : getting combo value field



faisal abbas
23 Feb 2009, 8:26 PM
hello every one!

we can get the value of combo box by Ext.getCmp('combo').getValue();
but don't need to get display field i need to get value field how can i ?
thanks

zhegwood
23 Feb 2009, 9:25 PM
Use the hiddenName config option.

faisal abbas
23 Feb 2009, 11:04 PM
i have assigned hiddenName and hiddenId as well and tried with both as
Ext.getCmp('hiddenName').getValue();
and
Ext.getCmp('hiddenId').getValue();

but it gives me the following error
Ext.getCmp("hDisplay") is undefined

help me to solve this prob

faisal abbas
23 Feb 2009, 11:16 PM
whts this???????????????????????

mjlecomte
24 Feb 2009, 5:56 AM
http://extjs.com/learn/Ext_Forum_Help#Code_Tags

http://extjs.com/learn/Ext_Forum_Help#Proper_Posting

hume
24 Feb 2009, 7:07 AM
example :

xtype : 'combo',
fieldLabel : 'Satuan',
id : 'id_units',
displayField: 'unit_name',
mode : 'remote',
triggerAction: 'all',
editable : false,
valueField : 'id_unit',
store : this.getStoreUnit()

store :

getStoreUnit : function(){
var This = this;
return new Ext.data.Store({
reader: new Ext.data.JsonReader({
fields : ['id_unit', 'unit_name'],
root : 'rows'
}),
proxy: new Ext.data.HttpProxy({
//disableCaching : false,
url : This.Url+'con_cat/get_units.php
}),
autoLoad: true
});
},


get Value from combo, just use Ext.getCmp('id_units').getValue().
but if u use Ext.get('id_units').getValue() , u will get value from property displayField.

good luck!!
YM : hemu_humeho