Ext通过后台校验字段是否重复

话不多说,直接上代码:

handlerRybh : function(textField) {
        Ext.Ajax.request({// ajax请求的方法
            url : 'userManage/person/checkPersonByRybh.json',
            params : {
                "rybh" : textField.getValue(),
            },
            scope:this,//使回调函数中的this变成当前的类
            success : function(res) {
                var data = Ext.decode(res.responseText);
                if (data.success == 'true') {
                    //do nothing
                } else if (data.success == 'ApplicationException') {
                    Ext.getCmp('personWindow').down('#rybh').setActiveError(data.errorMsg);
                    Ext.getCmp('personWindow').down('#rybh').doComponentLayout();//显示提示信息
                } else {
                    Ext.Msg.alert('系统错误提示', data.errorMsg);
                }
            },
            failure : function(res) {
                var respText = Ext.decode(res.responseText);
                Ext.Msg.alert('系统提示', respText.error);
            },
        });
    },
posted @ 2015-02-14 11:21  正正杂说  阅读(230)  评论(0编辑  收藏  举报