$("#addUserForm").validate({
errorPlacement: function(label, element) {
if (element.is(":radio") ){
element.parent().next().next().html(label);
}else{
element.parent().children("span").html(label);
}
},
success: function(label) {
label.addClass("checked").removeClass("error");
},
rules:{
loginName:{
required: true
},
password:{
required: true
},
confirmPassword:{
required: true,
equalTo:"#password"
},
name:{
required: true
/* rangelength: [ 3, 20 ],
remote:"/userNameCheck.htm" */
},
email:{
required: true,
email:true
},
"user.testdouble":{
required: true,
range: [13, 23]
}
},
messages: {
name: {
// required: "用户名不能为空"
/* rangelength: "用户名长度为{0}到{1}个字符",
remote:"该用户已经存在,请换别的用户名" */
},
confirmPassword:{
equalTo:"两次输入密码不一致!"
}
},
submitHandler: function(form) {
jQuery(form).ajaxSubmit({
type : "post",
dataType : "json",
url : "${ctx}/system/addUser.action",
data : {"operate" : "addUser"},
cache : "false",
beforeSubmit : beforeCallBack,
success : successCallBack,
error : errorCallBack
});
}
});
});