标签:
$(document).ready(function() {
//聚焦第一个输入框
$("#invtype").focus(); //form 第一个文本框
//为inputForm注册validate函数
$("#appInvoiceInputForm").validate({
onsubmit:true,
errorElement :"div",
errorPlacement: function(error, element) {
error.appendTo(element.parent());
},
rules: {
invdateStr:{
required:true,
onlyDate:true,
isDateBefore:true
},
buytaxno: {
required:true,
isNumOrLetter:true,
sbhLength:true
},
selltaxno:{
required:true,
isNumOrLetter:true,
sbhLength:true
},
invkind:{
required:true,
number:true,
minlength:[10],
maxlength:[10],
isInvkindMatchType:"#invtype"
},
invnum:{
required:true,
number:true,
minlength:[8],
maxlength:[8]
},
invcost:{
required:true,
onlyMoney:true,
notZero:true,
maxlength:[14]
},
invvat:{
required:true,
onlyMoney:true,
maxlength:[14]
},
invtaxno:{
required:true,
isNumOrLetter:true,
onlyDksbh:true,
dksbhLength:true
},
vatModel_mw1:{
onlyMw:true,
minlength:[21],
maxlength:[21]
},
vatModel_mw2:{
onlyMw:true,
minlength:[21],
maxlength:[21]
},
vatModel_mw3:{
onlyMw:true,
minlength:[21],
maxlength:[21]
},
vatModel_mw4:{
onlyMw:true,
minlength:[21],
maxlength:[21]
},
vatModel_nmw1:{
onlyMw:true,
minlength:[27],
maxlength:[27]
},
vatModel_nmw2:{
onlyMw:true,
minlength:[27],
maxlength:[27]
},
vatModel_nmw3:{
onlyMw:true,
minlength:[27],
maxlength:[27]
},
vatModel_nmw4:{
onlyMw:true,
minlength:[27],
maxlength:[27]
},
vatModel_cmw1:{
onlyMw:true,
minlength:[28],
maxlength:[28]
},
vatModel_cmw2:{
onlyMw:true,
minlength:[28],
maxlength:[28]
},
vatModel_cmw3:{
onlyMw:true,
minlength:[28],
maxlength:[28]
},
vatModel_cmw4:{
onlyMw:true,
minlength:[28],
maxlength:[28]
},
vendorid:{
number:true
}
},
messages: {
invdate:{
required: " 请输开票日期! "
},
buytaxno: {
required: " 请输入购方纳税人识别号! "
},
selltaxno: {
required: " 请输入销方纳税人识别号! "
},
invkind:{
required:" 请输入发票代码! ",
number:" 只能输入0-9间的数字! ",
minlength:"发票代码长度应为10位", //需要在页面 添加 maxlength="10";
maxlength:"发票代码长度应为10位"
},
invnum:{
required:" 请输入发票号码! ",
number:" 只能输入0-9间的数字! ",
minlength:"发票号码长度应为8位",
maxlength:"发票号码长度应为8位"
},
invcost:{
required:" 请输入金额! "
},
invvat:{
required:" 请输入税额! "
}
},
submitHandler: function(form) {
$("#loadingdiv").show();
disableButton();
form.submit();
}
});
});
标签:
原文地址:http://www.cnblogs.com/aGboke/p/4549707.html