论坛首页 入门技术论坛

请教一下ext2中form提交的数据返回问题

浏览 3107 次
该帖已经被评为新手帖
作者 正文
   发表时间:2007-11-13  
定义了一个form,提交时的事件代码如下
if(owner.formPanel.form.isValid()){
  owner.formPanel.form.submit({
    url:'../../backManage/employeeNew.action',
    method:'post',
    success:function(thisForm,thisAction){
      alert(thisAction.result.msg);
      if(thisAction.result.result==0)
        owner.store.reload();
    },
    failure:function(thisForm,thisAction){
      alert(thisAction.result.msg);
    },
    scope:this,
    clientValidation:false
  });
}


后台返回数据格式:
成功执行返回 {result:0,msg:'修改成功'}
抛出异常返回 {result:1,msg:'"+e.getMessage()+"'}

问题:不明白为什么form提交后只会调用failure函数,无论成功执行或者抛出异常
   发表时间:2007-11-14  
A response packet must contain a boolean success property, and, optionally an errors property. The errors property contains error messages for invalid fields.

By default, response packets are assumed to be JSON, so a typical response packet may look like this:


{
    success: false,
    errors: {
        clientCode: "Client not found",
        portOfLoading: "This field must not be null"
    }
}
0 请登录后投票
   发表时间:2008-06-26  
只要你后台有返回值就只会执行failure方法
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics