PDA

View Full Version : post custom params in forms



edmeehan
29 Sep 2010, 11:07 AM
So I have a form and I am using the form.submit() method, and it works fine.... but, it passes the wrong values for the params of the checkboxs. It looks something like this


?checkboxid=on
&checkboxid=on
&checkboxid=on

and I want to put them into an array and pass them like this


?checkbox=checkboxid,checkboxid,checkboxid

Is there a better method for building a custom param string... since form.submit() seems to be the set it and forget it method.

Any help would be great.. thanks in advance.

edmeehan
29 Sep 2010, 11:25 AM
Looking at using the ext.Ajax object and building my own custom calls for the form. Is there a better form method, or is this the best way to go?

plalx
29 Sep 2010, 12:12 PM
You can use the 'params' option with the submit() method to send your new 'checkbox' parameter.

Note: This will also send usual params submitted by the form but you can ignore them server-side.
If you don't want those params to be sent and you want to create a custom submit function, I would suggest you to create a custom form action by extending Ext.form.Action so that you can reuse your code.

edmeehan
29 Sep 2010, 12:20 PM
Thanks Scarsick for the response. Yeah I had tested the params option but I didn't like it sending the other parameters as well... I have OCD with that kinda stuff. I am currently using the ext.Ajax object to make the post to the server. Under my deadline I needed a fast solution. I do want to learn more about extending extjs objects, and think that will be my next step.

Thanks for the great idea and quick response.