PDA

View Full Version : Combo Submit Problem



dada87
18 Nov 2010, 8:57 AM
Hi,

I have a problem that I cannot solved.
I'm using Ext.form.Combobox in a FormPanel but when I submit the form the value returned by the field is the displayValue.

I declare the combobox in a fieldset, wich is in a AccordionLayout Panel wich is in the FormPanel:


new Ext.form.ComboBox({
fieldLabel: 'Default Priority',
name: 'dirscan_priority',
id: 'optDefPriority',
valueField: 'num',
displayField: 'text',
editable: false,
triggerAction : 'all',
mode: 'local'
}),


Then on the tab panel selection I load the store and choose the appropriate value:


Ext.getCmp('optDefPriority').bindStore(new Ext.data.ArrayStore({fields: ['num','text'],data:data.options.priorities}));
Ext.getCmp('optDefPriority').setValue(data.defScanPriority);


The Json in data.options.priorities look like this:


priorities:[
['-1',"$T('pr-low')"],
['0',"$T('pr-normal')"],
['1',"$T('pr-high')"],
['2',"$T('pr-force')"],
],


And I submit the form on the change value event:


Ext.getCmp('optDefPriority').addListener('change', function(field, oldvalue, value){
Ext.getCmp('optDefPriority').getForm().submit({
params: "session=" + session,
waitMsg: 'Saving...',
waitTitle: 'Wait',
success: function(form, action) {
infos("Configuration saved");
},
failure: function(form, action) {
infos("Error while saving: " + action.result.msg);
}
});
});


Everything else work fine except the comboboxes value...
Any idead?

In the same register I would like that the checkbox return a 0 value and not just a 1 value when they are checked.

I precise that I don't have access to server side code or process.

plalx
18 Nov 2010, 9:04 AM
Instead of the name config option, use hiddenName.

dada87
18 Nov 2010, 9:34 AM
It was that easy,

Thank you very much, I've been coding in round for the day and was pretty desperate.

Any idea about the checkbox problem?
I'd like them to always be submitted checked or not.