javascript - Extjs - combobox Submit value - Stack Overflow

Before ill ask my question I sould mention that i read every post about this problem.I am submitting my


Before ill ask my question I sould mention that i read every post about this problem.
I am submitting my extjs form using: form.getForm().getValues() in an independent ajax request.

I cant submit my value (userManager_userId) in a bo 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 bo 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 a Ext.data.JsonReader
Thanks

Update

So I did a little test for you to see live:
/ 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.


Before ill ask my question I sould mention that i read every post about this problem.
I am submitting my extjs form using: form.getForm().getValues() in an independent ajax request.

I cant submit my value (userManager_userId) in a bo 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 bo 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 a Ext.data.JsonReader
Thanks

Update

So I did a little test for you to see live:
http://fatnjazzy.byethost8./ 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.

Share Improve this question edited Mar 25, 2011 at 6:15 fatnjazzy asked Mar 24, 2011 at 6:17 fatnjazzyfatnjazzy 6,15212 gold badges59 silver badges85 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

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 bo box?When you use hiddenValue, you need to make use of hiddenName. hiddenValue just sets the default value for the bo. 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 bo box from:

 boObject.getValue()

Another possible reason why your form.getForm.getValues() do not give the bo'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..

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742351737a4427656.html

相关推荐

  • javascript - Extjs - combobox Submit value - Stack Overflow

    Before ill ask my question I sould mention that i read every post about this problem.I am submitting my

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信