$(function () {
$("#unitFrom").validate({
errorClass:"errorInfo", //默认为错误的样式类为:error
errorElement:"em",
focusInvalid: false, //当为false时,验证无效时,没有焦点响应
onkeyup: false,
submitHandler: function(form){ //表单提交句柄,为一回调函数,带一个参数:form
form.submit(); //提交表单
},
rules:{
"model.unitId":{
required:true,
remote: {
type: "post", //数据发送方式
url: "<%=path %>/biz/Unit_checkUnitId.action",
data: {
"model.unitId": function() {
return $("#unitId").val();
}
},
dataType: "html",
dataFilter: function(data, type) {
if (data == "true"){
return true;
}else{
return false;
}
}
},
rangelength:[1,100]
},
"model.unitName":{
required:true,
},
"model.unitPerson":{
required:true
}
},
messages:{
"model.unitId":{
required:"请输入教研室编号",
remote:"该教研室编号已经存在"
},
"model.unitName":{
required:"请输入教研室名称",
remote:"该教研室名称已经存在"
}
}
});
});