PDA

View Full Version : form submit return value (succes/failure)



alessio77
22 May 2012, 2:51 AM
i've an Ext.form.FormPanel that submits its value to an asp.net mvc action method
what kind of message/type/value this method have to return to make the "submission" succeeded
now it return to me always failure



Ext.define('myform', {
extend: 'Ext.form.FormPanel',
alias: 'widget.myform',
....,
....,
....,
....,
buttons: [{
text: 'Salva',
handler: function(){
var myForm = this.up('form').getForm();

myForm.submit({
url: 'DocumentEditor/SaveValues',
success: function(form, action) {
//...
alert('success');
},
failure: function(form, action) {
//...
alert('failure');
}
});


the asp.net action method


public JsonResult SaveValues()
{
var valori = Request.Form;
......do actions

return Json("{success:true}"); //<--- maybe isn't necessary
//what have it return?
}

mitchellsimoens
25 May 2012, 11:54 AM
So your ASP code is returning success false correct?

alessio77
27 May 2012, 10:57 PM
i don't know which "format" have to return the value, a json object like that? a http status code? another way?

chramer
27 May 2012, 11:23 PM
result=new {success="true"};
return Json(result);

alessio77
28 May 2012, 12:34 AM
in this way works perfectly :)
thanks a lot
A.

alessio77
28 May 2012, 12:37 AM
So your ASP code is returning success false correct?

infact, you're right!