PDA

View Full Version : Is there any way to catch malformed JSON responses from a form submit?



bclinton
1 Jan 2011, 10:00 PM
Hi,

According to the docs, responses from a BasicForm submit are expected to be in JSON format. If they are not, a Javascript error occurs. Is there any way to catch this error? Putting the form submit in a try/catch block does not work because BasicForm.submit() is asynchronous.

It seems to me that a more appropriate behavior would be for Ext to execute the submit's failure callback, perhaps with a "RESPONSE_INVALID" failureType.

I am trying to figure out a way to gracefully deal with things like 500 server errors which return HTML pages.

Thanks.

mitchellsimoens
2 Jan 2011, 7:51 AM
Look at the events on BasicForm and Action under the form tree.