page
bindFormValidate('entry_form',{
rules: {
"person.personcode":{required:true,IDcardVerify:true,minlength:18,maxlength:18,
remote: {
url: webroot+"/person/IDcardVerify", // background handler
type: "get", //data sending method dataType: "json", //accept data format
data: { //Data to be passed
personcode: function() { return $("#personcode").val();
},
id: function() { return $("#personid").val();
},
}
}
}
}, messages: {
"person.personcode":{
minlength: 'Please enter the 18-digit second-generation ID card',
manlength: 'Please enter the 18-digit second-generation ID card',
remote : "The
ID card has been duplicated, please re-enter
"
}
});
$.validator.addMethod("IDcardVerify",
function(value, element, param) {
var checkFlag = new clsIDCard(value);
return checkFlag.IsValid();
},
$.validator.format("
The format of the ID number is incorrect
")
);
background check code