PDA

View Full Version : Combobox displayField sumitted



fredrik.stockel
29 Jun 2007, 2:15 AM
I'm using a Ext to generate a form with some fields. One field is of type comboBox and contains data from a SimpleStore (example below)

This is the setup for the field:




...
var projData = [
['T1', 'Test project 1'],
['T2', 'Test project 2']
];
var projStore = new Ext.data.SimpleStore({
data : projData,
fields: ['value', 'text']
});

form.column(
{width:282},

....

new Ext.form.ComboBox({
fieldLabel: Project,
name: 'projectId',
mode: 'local',
store: projStore,
valueField: 'value',
displayField: 'text',
typeAhead: true,
listAlign: 'tl-bl',
triggerAction: 'all',
emptyText: 'Select...',
width: 270,
forceSelection: true,
selectOnFocus:true,
allowBlank:false
})

);
...


My problem is that when I submit the form the displayField is sent to the server and not the valueField, If I understod the documentation correctly, the valueField should be the value submitted to the server and not the displayField (eg, projectId=T1)

anyone encountered something similar or know how to send the valueField instead of the displayField?

fay
29 Jun 2007, 2:39 AM
Try adding hiddenName to the ComboBox's config:


...
hiddenName: 'projectId',
...

See http://extjs.com/forum/showthread.php?t=7745

fredrik.stockel
29 Jun 2007, 3:55 AM
Try adding hiddenName to the ComboBox's config:


...
hiddenName: 'projectId',
...

See http://extjs.com/forum/showthread.php?t=7745



It worked perfectly! Thanx