//第一组校验组,默认组号为"1"
$.formValidator.initConfig({formID:
"id_frm_password"
,errorFocus:
false
,onSuccess:check,onError:
function
(msg,obj){jAlert(msg,
"温馨提示"
,
function
(){obj.focus();})}});
$(
"#id_p_userName"
).formValidator({onFocus:
"用户名只能含有汉字,字母,数字或下划线"
})
.inputValidator({min:1,max:20,onErrorMin:
"对不起,请您输入用户名"
,onErrorMax:
"对不起,您输入的用户名超过了20个字"
});
$(
"#id_oldPassword"
).val(
""
).formValidator({empty:
true
})
.inputValidator({min:1,max:36,onErrorMin:
"对不起,请您输入原密码"
,onErrorMax:
"对不起,你输入的原密码超过了36个字符"
});
//第二个验证组
$.formValidator.initConfig({validatorGroup:
"2"
,formID:
"id_frm_userinfo"
,errorFocus:
false
,onSuccess:check,onError:
function
(msg,obj){jAlert(msg,
"温馨提示"
,
function
(){obj.focus();})}});
$(
"#id_p_realName"
).formValidator({validatorGroup:
"2"
}).inputValidator({min:1,max:20,onErrorMin:
"对不起,请您输入家长姓名"
,onErrorMax:
"对不起,您输入的家长姓名超过了20个字"
});
$(
"#id_p_tel"
).formValidator({validatorGroup:
"2"
}).inputValidator({max:20,onErrorMax:
"对不起,您输入的电话超过了20个字"
});
$(
"#id_p_qq"
).formValidator({validatorGroup:
"2"
}).inputValidator({max:20,onErrorMax:
"对不起,您输入的QQ号超过了20个字"
});
$(
"#id_p_mail"
).formValidator({validatorGroup:
"2"
}).inputValidator({max:20,onErrorMax:
"对不起,您输入的邮箱超过了50个字"
});
$(
"#id_p_weixin"
).formValidator({validatorGroup:
"2"
}).inputValidator({max:20,onErrorMax:
"对不起,您输入的微信号超过了20个字"
});
下载API帮助、源码、示例:
转载请注明:苏demo的别样人生 » formValidator同页面验证多个表单