PDA

View Full Version : [RESOLVED] Combobox : hiddenname, name, valuefield ?



senacle
20 Sep 2010, 3:42 AM
Hello !

I've a combobox :


new Ext.form.ComboBox({
.....
displayField: 'display_categorie',
.....
hiddenName: 'nom_categorie',
id: 'idjs_admin_combo_categorie',
listeners: {
select: function() {
var combo_categorie = Ext.getCmp('idjs_admin_combo_categorie');
var id_categorie = combo_categorie.getValue();
.....
Ext.getCmp("idjs_form_admin_categorie").getForm().load({
failure: function(form, action) {
Ext.Msg.alert("Le chargement des données a échoué.", action.result.errors);
},
params:{id_categorie: id_categorie},
url:'htdocs/Admin/selection_categorie.php',
waitMsg:'Chargement en cours...'
});
.....
name: 'nom_categorie',
.....
store: categorie_2,
.....
valueField:'value_categorie',
})


With the store :

var categorie_2 = new Ext.data.JsonStore({
autoDestroy: true,
url: 'htdocs/Commun/categorie.php',
root: 'data_categorie',
storeId: 'store_categorie',
fields: ['display_categorie', 'value_categorie', 'description_categorie']
});


Some example of the values in the store :
'display_categorie' : 'Bonjour'
'value_categorie' : 1
'description_categorie' : 'Comment allez-vous ?'


All is working fine when i select a value in the combo, it's the valuefield which is posted (id_categorie = combo_categorie.getValue()) and in firebug, i can see this value (ie the store's value_categorie : 1)

But, when the select listeners is ended, i can see in firebug that combo_categorie.getValue() is the displayField value (ie the store's display_categorie : 'Bonjour').


Some idea ?
What did i do wrong ?

senacle
30 Sep 2010, 3:51 AM
What's wrong ?

I had two fields with the same name.

I change one name, and all is working fine !