PDA

View Full Version : [CLOSED][3.??] failure function not triggered by JSON response



gkc44
22 Jun 2009, 12:54 PM
My backend returns the following JSON

{"success":"false","errors":"Bad stuff"}

but to have my form submit failure function triggered I needed to make the following change to the ext-all-debug.js code as result.success is the string "false" which evaluates to true on the right side of the or expression.

@@ -35524,7 +35524,7 @@ Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
// private
success : function(response){
var result = this.processResponse(response);
- if(result === true || result.success){
+ if(result === true || result.success == 'true'){
this.form.afterAction(this, true);
return;
}

Is this a bug or is my JSON response incorrect?

evant
22 Jun 2009, 7:08 PM
Your response is incorrect. Why return a string literal for a boolean value?

gkc44
23 Jun 2009, 1:59 AM
Thanks. I will fix my JSON response.