I’m using Extjs 4.0.7 and having a hard time getting a combobox in a formPanel to submit the fieldValue of the selected option on the combobox.
As far as I can tell this is normally achieved by setting the hiddenName configuration option to a value you want it to submit the value as; like using a hidden field in html, but the hiddenName option now seems to be removed from the docs, without any obvious alternatives.
So how do I go on about submitting my formPanel with the value of the valueField in Extjs 4?
This is a snip from my application, where I define one of the comboboxes:
xtype: 'combobox',
name: 'shift',
hiddenName: 'shiftid',
id: 'shiftCombobox',
fieldLabel: 'Shift',
labelWidth: 30,
width: 130,
margin: '0 5',
cls: 'shift',
store: shiftStore,
autoSelect: true,
queryMode: 'local',
displayField: 'name',
valueField: 'objectid',
autoSelect: true,
handler: function() {
//changeShift();
}
and this is the model which the shiftStore uses:
Ext.define('shiftModel', {
extend: 'Ext.data.Model',
fields: [
{name: 'objectid', type: 'int'},
{name: 'name', type: 'string'}
]
});
I had forgotten about this code:
Which updates the
comboboxon thecombobox‘s storesautoLoad, to use a default value on load.I had set the value to name which is the
displayValue. Setting the value to the correspondingfieldValue, in my case a field called objectidAfter I set it like this, it works:
Now the
comboxsubmits it’s realfieldValueinstead of the textual value I accidentally set.I’d still like to know if there is some way to control this though.