I have a simple ExtJS form, but I would like to add additional attributes to be sent as post dat开发者_C百科a.
I have tried form.setValues({name:value})
but for some reason it does not actually set the value...
Thanks
The documentation for setValues
says:
Set values for fields in this form in bulk.
From that I take it that the fields have to exist in the form for the values to be set, so add hidden fields to the form. http://dev.sencha.com/deploy/dev/docs/?class=Ext.form.Hidden
You can do that in your FormPanel
config or using formPanel.add
[{
xtype: 'hidden',
name: 'hidden1',
value: 'hiddenValue1'
}, {
xtype: 'hidden',
name: 'hidden2',
value: 'hiddenValue2'
}]
If you need to set the values dynamically, you can now use form.setValues
.
Also can directly add the additional value to submit parameter: url or params
like this:
this.theWindow.get(0).getForm().submit({
url : 'youraction.action?name=value',
success : function(form, action) {
...
},
failure : function(form, action) {
...
}
}
or
this.theWindow.get(0).getForm().submit({
url : 'youraction.action',
params : {name : value},
success : function(form, action) {
...
},
failure : function(form, action) {
...
}
}
精彩评论