Extjs - combobox Submit value
form.getForm().getValues()
in an independent ajax request.
I cant submit my value (userManager_userId) in a combo to to the server:
new Ext.form.ComboBox({
name: 'userManager_userName',
valueField: 'userManager_userId',
hiddenValue : 'userManager_userId',//I want to send this ti the server (Integer)
displayField: 'userManager_userName'
....
)}
The combo providing/submitting its display and not its value.
I should mention that when the for loads, I charge it with data from the server by using aExt.data.JsonReader
Thanks
Update
So I did a little test for you to see live:
http://fatnjazzy.byethost8.com/ you can view source to see the js source. Ill post it here when we are done. Now it is working but the form does not initial its values.Use hiddenName in place of or in addition to name. This will create a hidden field of that name which will store the value of the current selection's valueField. Also note that the hiddenValue config is for setting the initial value of the hidden field and is not a field name declaration.
Here is an altered ComboBox definition which will submit the value of the selected record's userManager_userId field through a request parameter of userId:
new Ext.form.ComboBox({
hiddenName: 'userId',
valueField: 'userManager_userId',
displayField: 'userManager_userName',
// ...
});
Do you have hiddenName
property set for your combo box?When you use hiddenValue
, you need to make use of hiddenName
. hiddenValue
just sets the default value for the combo. By setting it you will not be able to send the value to the server side.
Update: Since you are using separate Ajax request to submit the form, why are you using hidden field to store the values? you could access the value of the combo box from:
comboObject.getValue()
Another possible reason why your form.getForm.getValues() do not give the combo's values will be due to having wrong value in valueField
. In your case you have userManager_userId. Is that your underlying data value name to bound to the ComboBox? Here is my example:
store: new Ext.data.JsonStore({
fields:['item','value'],
data: [
{item:'Option 1',value: 'OP1'},
{item:'Option 2',value: 'OP2'},
{item:'Option 3',value: 'OP3'}
]
}),
mode: 'local',
editable: false,
allowBlank: false,
forceSelection: true,
valueField: 'value',
displayField: 'item',
name:'tt',
id: 'tt'
Here the valueField's value is bound to my store's value field..
精彩评论