PDA

View Full Version : Can I submit more value from a combo?



SpinoWeb
8 Mar 2011, 9:54 AM
that's my combo inside the form:

var clsCombo = {
xtype : 'combo'
,store : clsStore
,fieldLabel : 'Name'
,valueField : ['clsTypeId', 'clsType']
,hiddenName : ['clsTypeId', 'clsType']
,displayField : 'clsType'
,typeAhead : true
,mode : 'local'
,emptyText: 'Select...'
,triggerAction: 'all'
,forceSelection: true
,listeners: {
select: function(valueField) {
var clsId = valueField.getValue();
console.log('clsId: ' + clsId);
}
}

};
I'd like to submit both values 'clsTypeId' and 'clsType'. As above doesn't work. Is there any other method?

thank you!

brittongr
8 Mar 2011, 12:59 PM
valueField and hiddenName both are strings you can't pass an array at least according to documentation (http://dev.sencha.com/deploy/dev/docs/), and and i think you don't need a hiddenName field for that just in the select function use the the record parameter to access the displayField.



var clsCombo = {
xtype : 'combo'
,store : clsStore
,fieldLabel : 'Name'
,valueField : 'clsTypeId'
,displayField : 'clsType'
,listeners: {
select: function(comboBox, record) {
var clsId = record.data[comboBox.valueField];
var clsDisplay = record.data[comboBox.displayField];

console.log('clsId: ' + clsId);
}
}
Hope it helps!

SpinoWeb
9 Mar 2011, 8:57 AM
Thank You!