PDA

View Full Version : form.submit successful on empty response?



oger000
17 Feb 2011, 2:19 AM
Hello

Is it intended, that an empty response (0 byte long) to form.submit (Ext.form.Action.Submit) is handled in the success function, event if no success property is present?

So I check:

success: function(form, action) {
if (action != undefined && action.result != undefined &&
action.result.success != undefined && action.result.success == true) {
// do what i want;
}
else {
// handle failure case
}
} // end of success function
failure: function (form, action) {
// handle failure case more or less again
}


This duplicates error handling.
1) In own check if response is empty and
2) in failure function which is called, when:
a) action is an object and no success property is given
b) the success property is given but results to false


Do I things unneccessary complicated - maens: is there a better way to catch empty response and direct it to the failure function?


Used version extjs 3.3.1

thanks in advance
gerhard

Condor
17 Feb 2011, 2:30 AM
Ext.override(Ext.form.Action, {
processResponse : function(response){
this.response = response;
/*if(!response.responseText && !response.responseXML){
return true;
}*/
this.result = this.handleResponse(response);
return this.result;
}
});

oger000
18 Feb 2011, 10:48 AM
I did not venture to dive so deep into extjs code. But thank you for the pointer, now I know where to start ;-)