PDA

View Full Version : Interesting Combo Population Problem



StevenInc
25 Feb 2010, 7:45 PM
I have the following combobox that submit a numeric value when month is selected.



var ccExpMonth = {
xtype : "combo",
fieldLabel : "Month",
name : "ccMonth",
allowBlank : false,
blankText : 'Expiration Month is Required',
editable : false,
width : 80,
triggerAction : "all",
mode : "local",
displayField : 'text',
valueField : 'value',
hiddenName : 'ccMonth',// use hiddenName to submit the value and not the text
store : new Ext.data.SimpleStore({
fields : ["value","text"],
data : [
["1","Jan"],
["2","Feb"],
["3","Mar"],
["4","Apr"],
["5","May"],
["6","Jun"],
["7","Jul"],
["8","Aug"],
["9","Sep"],
["10","Oct"],
["11","Nov"],
["12","Dec"]
]
}),
};


And this works fine.
But when I populate the form values with
formPanel.getForm().load({}) with the 3 character month code

The combobox submits the the 3 characters instead of the numeric value.

How can I submit the numeric value instead and the form has been populated.
Any assistance would be appreciated.

Thanks

fay
26 Feb 2010, 3:08 AM
I think you need to assign different values to the name and hiddenName config options, or as the docs (http://www.extjs.com/deploy/dev/docs/?class=Ext.form.ComboBox) suggest:


if the ComboBox name and hiddenName are the same, you should specify a unique hiddenId.

StevenInc
26 Feb 2010, 6:10 AM
Thanks for the reply.
as it turns out that did not solve the problem.