tags:

views:

500

answers:

2

Looking at the source code of Action.Submit, I'm trying to figure out where ext is appending the form's fields to the parameters.

Instead of sending each field as a separate parameter, I want to send something like:

formObj:{field1:value, field2:value}

Currently, each of those values are simply added to the parameter list along with any custom/baseParams.

Where are these formfields being added so that I can change this behaviour?

Thanks.

A: 

If you really want to track the process of creating parameter list, you can refer to Ext.form.Action.getParams.

You should also consider Ext.form.BasicForm.getValues as it returns exactly the result you want, the only problem is that you'll need to send it manually, e.g. using Ext.Ajax.request.

Li0liQ
ya, I already have no problem packaging up my own params and sending them. The problem is that all the other params are polluting the request, in addition to my custom object.Action.getParams refers only to the baseParams, and customParams. Not to the form fields.
Scott
A: 

I'm not sure what your override needs to look like, but you'll probably want to look at Ext.Ajax.request() (in Core / Connection.js). When posting a form, the fields get serialized there, in this code block:

            if(form = Ext.getDom(o.form)){
                url = url || form.action;
                serForm = Ext.lib.Ajax.serializeForm(form);                 
                p = p ? (p + '&' + serForm) : serForm;
            }
bmoeskau
Gracias. Ya, inside the Action.Submit I found that the form itself was being passed into the Ext.Ajax.request, and that makes sense now. So I can override the Action class at that level to check a flag as to whether or not I want to submit the form.
Scott