Combo box submits display field instead of value field
Hi guys,
I have a problem with a combo box contained in a form: I expect that it submits 'value field', but it actually submits display field.
This is the code to define the combo box:
Code:
xtype: 'combobox',
fieldLabel: 'Company',
name: 'customer_id',
allowBlank:false,
afterLabelTextTpl: required,
id: 'customer_id_combo',
hiddenName : 'customer_id',
store: customer_store,
valueField: 'id',
displayField: 'company',
typeAhead: true,
queryMode: 'remote'
Finally, here's the code to submit form containing the combo box we're talking about:
Code:
buttons: [{
text: 'Update branch',
handler: function() {
var form=this.up('form').getForm();
if (form.isValid()) {
Ext.Msg.alert('Wait', 'Data are being saved...');
form.submit({
clientValidation: true,
url: 'controller/crud.php?a=u&item=branch',
success: function(form, action) {
Ext.MessageBox.alert('Success','branch was updated');
Ext.Function.defer(Ext.MessageBox.hide, 2000, Ext.MessageBox);
branch_store.load();
},
failure: function(form, action) {
Ext.Msg.alert('Error','an error occured');
}
});
}
else{
Ext.Msg.alert('Error','form is not valid');
}
}
}]
Does anyone know how to fix that code in order to submit 'value field' instead of 'display field' ?
Thanks in advance!