php formvalidator,jQuery formValidator对于多个表单如何分组校验?

充栋
2023-12-01

参考思路:$.formValidator.initConfig方法的validatorGroup属性

$.formValidator.initConfig({

validatorGroup:"1",

formID:"validateEmailForm1",

AjaxPrompt : "有数据正在异步验证,请稍等...",

theme : "126",

submitOnce : true,

ajaxForm : {

type : "POST",

dataType : "html",

buttons : $("#button"),

url : "sendEmailValidateLink",

success : function(data) {

if(data == "noLogin"){

alert("您还没有登录!");

}else if (data == "success") {

$("#emailValidatedDiv").html("");

return true;

}

return false;

}

},

onError : function(msg) {

},

submitAfterAjaxPrompt : '有数据正在异步验证,请稍等...'

});

----------------------------------------------------------------

$("#valid").formValidator({

validatorGroup:"2",

formID:"validateEmailForm2",

onShowFixText : "点击验证码可更换验证码,验证码不区分大小写。",

onShow : "请输入验证码",

onFocus : "验证码的长度必须是4位",

onCorrect : "验证码正确"

}).inputValidator({

min : 4,

max : 4,

onError : "验证码的长度必须是4位,请确认"

}).ajaxValidator({

type : "POST",

dataType : "html",

async : true,

url : "validateCode",

success : function(message) {

if (message == "success") {

return true;

}else{

return false;

}

},

buttons : $("#button"),

error : function(jqXHR, textStatus, errorThrown) {

alert("服务器忙" + errorThrown);

},

onError : "验证码错误",

onWait : "正在进行合法性校验,请稍候..."

});

 类似资料: