PDA

View Full Version : ComboBox with well conigured store send displayField instead valueField



Wolfie
3 Nov 2010, 1:49 AM
Hey

I have this code :



var languageCombo = new Ext.form.ComboBox({
fieldLabel: tr('j?zyk interfejsu'),
store: new Ext.data.ArrayStore({
fields: ['language', 'name'],
data: [['pl', tr('polski')],['en',tr('angielski')],['ru', tr('rosyjski')]]
}),
valueField: 'language',
displayField: 'name',
name: 'language',
mode: 'local',
triggerAction: 'all',
editable: false
});
var overalDataPanel = new Ext.form.FormPanel({
title: 'Ogólne',
padding: 4,
buttonAlign: 'center',
border: false,
defaults: {anchor: '95%'},
items : [emailField, mobileFiled, languageCombo],
buttons: [
{text: tr('Zapisz'), handler: function(){
var form = overalDataPanel.getForm();
//console.log(languageCombo.getValue());
if(form.isValid()){
form.submit({
url: App.baseUrl + '/user/update-user-settings',
params: {id: config.id, lang: languageCombo.getValue()},
success: function(form,action) {
VCC.Info(tr('Dane zapisane pomy?lnie'))
},
failure: function(form,action){
Ext.MessageBox.alert('Erro','Error');
}

});
}
}
},
{text: tr('Zamknij'), handler: function(){
self.close();
}
}
]
//some other code here
});

And after I am submitting the form than POST looks like this :



email [email protected]
id 1926
lang pl
language polski
mobile 48505190943
So in language POST param instead of valueField the displayField is sent

any ideas why ?

Condor
3 Nov 2010, 1:51 AM
name: 'language' -> hiddenName: 'language'

Wolfie
3 Nov 2010, 2:03 AM
Thanks Condor :)