I have the following save:
var saveResponse = rene.save({
success: function(response, opts) {
console.log('The Child was saved, response: '+response);
},
failure: function(response, opts) {
console.log('The Child save was a failure response: '+response);
console.log('The Child save was a failure opts: '+opts);
}
});
The server validates the data sent in, and in case of any errors it returns this:
{"validationErrors":{
"phoneNumber":"Account with this email already exists",
"birthDateString":"Use following format: yyyy-MM-dd. Example: 2012-11-22"}
}
But the save method has the following API which only returns:
http://docs.sencha.com/touch/2-0/#!/api/Ext.data.Model-method-save
"...they will all be invoked with the Model and Operation as arguments.",
So my question is:
How can get the response (the JSON above) in return when it only provides me with the Model (I assume it only give me the original json I sent in the post body since I dont return the full model in return) ? Is it something I overlook, or shouldnt REST POST requests from a semantically point of view ever fail (here: validation errors)?