View Full Version : [OPEN] [4.1] ComboBox getValue returns displayField instead of valueField

18 Dec 2012, 7:16 AM
Method getValue returns displayField instead of valueField when value containes a "\n".
I've used a modified combobox from your examples.
Just replace the following code with the first combobox located in "examples/form/combo.html":

// Simple ComboBox using the data store
var simpleCombo = Ext.create('Ext.form.field.ComboBox', {
fieldLabel: 'Select a single state',
renderTo: 'simpleCombo',
displayField: 'name',
width: 320,
displayField: 'description',
valueField: 'value',
labelWidth: 130,
store: Ext.create('Ext.data.Store', {
fields: ['value', 'description'],
data: [
{value: '123', description: 'Hello test'},
{value: '1234', description: 'Hello\ntest2'}
proxy: {
type: 'memory',
reader: {
type: 'json'
listeners: {
select: function() {
console.log('value', this.getValue());
queryMode: 'local',
typeAhead: true

Tested with ExtJS 4.1.0 and 4.1.1a

18 Dec 2012, 8:01 AM
Thanks for the report! I have opened a bug in our bug tracker.

28 Jun 2013, 8:36 AM
I'm also facing this issue still using 4.1.3.

Has the bu been solved or a workaround found by anyone?


28 Jun 2013, 9:17 AM
I managed to solve this with the following work around.

Set your displayField and valueField to always be the same, so even if the displayField is returned you will have the correct value.

Then override the displayTpl to show what you actually want. eg:

component.displayTpl = Ext.create('Ext.XTemplate',
'<tpl for=".">',