success : function(form, action) {
alert("c");
                        }
也许成功返回了你并不知道。

解决方案 »

  1.   

    现在又有个问题,regBtn.on("click", function() {
    if (regForm.getForm().isValid()) {
    Ext.lib.Ajax.defaultPostHeader += ";charset=utf-8";
    regForm.getEl().mask();
    status.setText("正在注册...");
    regForm.getForm().submit({
    url : "register",
    method : "POST",
    success : function(form, action) {
    alert("shao");
    regForm.getEl().unmask();
    var result = action.response.responseXML
    .getElementsByTagName("result")[0].firstChild.data;
    if (result == "true") {
    status.setText("注册成功");
    regForm.getForm().reset();
    tab.setActiveTab(logonForm);
    } else {
    status.setText("注册失败,用户名已被占用");
    }
    },
    failure : function(form, action) {
    alert("sdfsdf");
    }
    });
    }
    });在FIREFOX下这段代码没有问题,可是在IE下。
    alert("shao");执行不到,?????????
      

  2.   

    在IE里面是因为regForm.getForm().isValid()这句为false,所以才执行不到alert("shao");
      

  3.   

    现在已经修改好了 在ff和IE里都测试了 没有问题 把一些不存在的对象注释了 另外把有些属性定义的不正确 也已经注释掉了
    代码如下:
    <body>
        <form id="form1" runat="server">
        <div>
        <script type="text/javascript">
        function ready()
        {
            var regBtn = new Ext.Button({text : "注册" });
       
            regBtn.on("click", function() 
            {
                debugger;
                if (regForm.getForm().isValid()) 
                {
                    Ext.lib.Ajax.defaultPostHeader += ";charset=utf-8";
                    regForm.getEl().mask();
                    //status.setText("正在注册...");
                    regForm.getForm().submit
                    ({
                        url : "register.aspx",
                        method : "POST",
                        success : function(form, action) 
                        {
                            debugger;
                            alert("shao");
                            regForm.getEl().unmask();
                            //将服务器端返回的字符川转换成对象
                            var result = Ext.util.JSON.decode(action.response.responseText);
                            //var result = action.response.responseXML
                            //         .getElementsByTagName("result")[0].firstChild.data;
                            if (result.success&&result.success == true) 
                            {
                                //status.setText("注册成功");
                                Ext.Msg.alert("提示消息","注册成功");
                                regForm.getForm().reset();
                                
                                //tab.setActiveTab(logonForm);哪里有这个tab
                            } 
                            else 
                            {
                                //status.setText("注册失败,用户名已被占用");
                                Ext.Msg.alert("提示消息","注册失败,用户名已被占用");
                            }
                        },
                        failure : function(form, action) 
                        {
                            alert("sdfsdf");
                        }
                    });
                }
            });        var regForm = new Ext.form.FormPanel
            ({
                title : "注册",renderTo:document.body,
                defaultType : "textfield",
                url : "register",
                defaults : {autoHeight : true},
                frame : true,
                buttons : [regBtn],
                labelWidth : 60,
                items : 
                [
                    {
                        fieldLabel : "用户名",
                        name : "userNameReg",
                        id : "userNameReg",
                        anchor : "80%",
                        //vtype : "checkUserName",//能够这么用吗?
                        allowBlank : false,
                        blankText : "用户名不能为空"
                    }, 
                    new Ext.form.ComboBox
                    ({
                        fieldLabel : '性别',
                        triggerAction : "all",
                        name : 'sexReg',
                        id : "sexReg",
                        value : "男",
                        store : new Ext.data.SimpleStore
                        ({
                            fields : ['sexReg'],
                            data : [['男'], ['女']]
                        }),
                        displayField : 'sexReg',
                        mode : 'local',
                        allowBlank : false,
                        blankText : "性别不能为空",
                        selectOnFocus : true,
                        anchor : "80%"
                    }), 
                    {
                        fieldLabel : "密码",
                        name : "passwordReg",
                        blankText : "密码不能为空",
                        id : "passwordReg",
                        inputType : "password",
                        anchor : "80%",
                        allowBlank : false
                    }, 
                    {
                        fieldLabel : "重复密码",
                        name : "rePasswordReg",
                        id : "rePasswordReg",
                        inputType : "password",
                        anchor : "80%",
                        //vtype : "password",
                        initialPassField : "passwordReg",
                        blankText : "重复密码不能为空",
                        allowBlank : false
                   }, 
                   {
                        fieldLabel : "邮箱",
                        id : "emailReg",
                        name : "emailReg",
                        blankText : "邮箱不能为空",
                        anchor : "80%",
                        //vtype : "email",
                        allowBlank : false
                   }
               ]
            });
        }    
        Ext.onReady(ready);    
        </script>
        </div>
        </form>
    </body>
    欢迎访问EXT博客
      

  4.   


    regBtn.on("click", function() {
    if (regForm.getForm().isValid()) {
    Ext.lib.Ajax.defaultPostHeader += ";charset=utf-8";
    regForm.getForm().submit({
    url : "register",
    method : "POST",
    success : function(form, action) {
    alert("success");
    },
    failure : function(form, action) {
    alert("failed");
    }
    });
    }
    });我现在把代码直接修改成这样,可是success的方法就是不会执行,
    直接把服务器关了在提交数据,或是人为的把服务器抛出异常,failure方法就会被执行,
    服务器成功返回后success方法就是不执行,?咋办啊?????????