View Full Version : form submit and the expected success key in the response

30 Jan 2008, 5:14 PM
It has become pretty apparent from the documentation and these forums that the form.submit function requires 'success' to be one of the keys in the response from the server. Here is one of those threads:


Apparently either you can use form.submit and ensure that 'success' is in your response, or you can handle the AJAX request directly. I would rather use the form.submit. However, I don't have much control over the format of the response (I am conforming to TurboGears TGWebServices which returns the response wrapped in 'result').

Why can't we dictate a reader to handle the response with an accompanying root instead of hard-coding the success in our response. We could even pass a function that would determine if the response is successful or not. Is this an issue of performance, or simply something to which noone has gotten around? Thanks.


30 Jan 2008, 6:29 PM
You could certainly build that behavior. The Form.Action class was built with user customization in mind. There's no way Ext could account for all the ways form processing needs to be handled.

1 Feb 2008, 10:25 PM
Thanks Tim. Looks like I might be poking around at extending Action.submit.

1 Feb 2008, 11:37 PM
It is also possible to use the FormPanel errorReader config option to specify a JsonReader that can handle the extra result object in the response, e.g.

errorReader: new Ext.data.JsonReader({
successProperty: 'result.success',
root: 'result.errors'

6 Feb 2008, 1:43 PM
I've been looking for the same thing, I will try this.
It's not listed as a config option in FormPanel docs though, is this an oversight?

Saw it used in the 'Loading/Saving a Dynamic Form using XML' example as well.