Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ExtJS add additional data into the post of a form

Tags:

extjs

I have a simple ExtJS form, but I would like to add additional attributes to be sent as post data.

I have tried form.setValues({name:value}) but for some reason it does not actually set the value...

Thanks

like image 848
neolaser Avatar asked Jan 27 '26 02:01

neolaser


1 Answers

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.

like image 138
Hemlock Avatar answered Jan 28 '26 22:01

Hemlock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!