validate校验的应用

$("#inputForm").validate({
rules: {
pid:"required",
taxMonth: {
required:true,
remote: {
url:"${ctx}/tax/busTax/checkTaxMonth", 
data:{
pid: function () { return $("#pid").val(); },
taxMonth: function () { return $("#taxMonth").val(); 


}
}
   }
},
invoiceNumber:{
required:true,
digits:true
},
taxNumber:"required",
taxFrom:"required",
taxEnd:"required",
rcbn:"required",
rcbt:"required",
rpbn:"required",
rpbt:"required",
},
messages: {
pid:"请选择核名名称",
taxMonth:{
required:"请填写税收缴纳月",
remote:"您本月已缴过税款",
},
invoiceNumber:{
required:"请填写开票量",
digits:"必须为整数" 
},
taxNumber:"请填写纳税额",
taxFrom:"请填写税收起始月份",
taxEnd:"请填写税收结束月份",
rcbn:"请填写预计企业返税金额",
rcbt:"请填写预计企业返税时间",
rpbn:"请填写预计园区返税金额",
rpbt:"请填写预计园区返还时间",
},
submitHandler: function(form){
loading('正在提交,请稍等...');
form.submit();
},
errorContainer: "#messageBox",
errorPlacement: function(error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is


(".input-append")){
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});

你可能感兴趣的:(技术)