PDA

View Full Version : Combo submits displayValue instead of fieldValue



BlueCamel
24 Nov 2009, 8:34 PM
I have a simple combox in a form panel. When I look at the data passed via POST to my php code the value of the combo box is the displayField value, not the valueField. I'm sure I'm just staring at this too long... so a second set of eyes would be appreciated.

Here is my store and the form panel with the combo box. If I select 'Request Support' from the combo box I expect to receive a POST var of 'action' with a value of 'support'. Instead it contains 'Request Support'.

Thoughts?




var store = new Ext.data.ArrayStore({
autoDestory: true,
storeId: 'comboStore',
idIndex: 0,
fields: ['value', 'text'],
data: [
['feedback', 'Feedback'],
['support', 'Request Support'],
['burt', 'Report Bug']
]
});

var form = new Ext.FormPanel({
url: '/feedback/submit',
labelWidth: 100,
items: [{
xtype: 'textfield',
fieldLabel: 'My User ID',
width: 220,
name: 'userid',
vtype: 'alphanum',
maxLength: 32,
allowBlank: false,
},{
xtype: 'combo',
fieldLabel: 'Action',
width: 220,
name: 'action',
mode: 'local',
store: 'comboStore',
valueField: 'value',
displayField: 'text',
triggerAction: 'all',
emptyText: 'Select...',
selectOnFocus: true,
allowBlank: false
}],
buttons: [{
text: 'Reset',
handler: function() {
form.getForm().reset();
}
},{
text: 'Submit Feedback',
handler: function() {
form.getForm().submit();
}
}]

aconran
24 Nov 2009, 10:12 PM
Specify the hiddenName configuration and give it the same value as the name config.

BlueCamel
24 Nov 2009, 11:32 PM
Specify the hiddenName configuration and give it the same value as the name config.

Is hiddenName required any time when using value/name pair?

I ask because when I read through the docs tonight, the ComboBox in Grid example on the combo api page does not use a hiddenName. However, it does use an array store with value/name pairs as my code above does.

I'll give it a try, thanks!