PDA

View Full Version : getValue() from combo not returning



mitchellsimoens
29 Jul 2009, 10:52 AM
I try getting the value of a combobox using it's onSelect function but it returns as an empty string. The Ext.data.Store that I use pulls correctly and the combobox displays it correctly with the right value.


var panel = new Ext.Panel({
frame:true,
width:500,
autoHeight:true,
layout:'fit',
title:'Contacts',
items: new Ext.FormPanel({
labelWidth: 75,
url: "functions.php",
id: "contactForm",
frame: true,
bodyStyle: "padding:5px 5px 0",
autoHeight: true,
autoWidth: true,
items: [new Ext.form.ComboBox({
triggerAction: 'all',
name: 'contact',
id: 'contactCombo',
mode: 'local',
lazyInit: true,
displayField: 'name',
valueField: 'address',
inputType: 'text',
store: contactsDataStore,
onSelect: function(thisCombo, thisRecord, thisIndex) {
alert(thisCombo.getValue());
}
})
]
})
});
panel.render(document.body);

nassima
30 Jul 2009, 1:25 AM
hi,
try this:
combo.on('select',function(combo,record,index){

alert(combo.getValue());
});