PDA

View Full Version : Form success



bkraut
16 Sep 2009, 2:02 AM
Hi,

I'm getting this response back from the server when I trigger submit:

http://localhost:8080/ObjectVerse/Controller/Persistence/Save 200 OK 21ms

the code that triggers submit is:



onSubmit: function(btn, e) {
if (!this.metaForm.getForm().isValid()) {
Ext.MessageBox.alert("Error", "Form is invalid.");
return false;
}
else {
this.metaForm.getForm().submit({
method: 'POST',
waitTitle: 'Connecting',
url: 'Controller/Persistence/Save',
params: {
mid: this.mid
},
success: function(){
this.close();
},
failure: function(form, responseData){
Ext.MessageBox.alert('Error', Ext.decode(responseData.response.responseText).message);
},
waitMsg: 'Saving...',
scope: this
});
}
}


The problem is that an error message is raised because failure is executed instead of success.
How is this possible?
This is json that I receive back from the server:

{success: true, message: 'Record sucessfully saved.'}

Seems correct.