jQuery.validator.addMethod(
"invalidPin",
function (value, element) {
if ($('#Pin').attr('checked') == true) {
if (element.value == 0 || element.value == undefined || element.value == '') {
return false;
}
else
return true;
}
else return true;
});
$('#create').validate({ ignore: ":not(:visible)",
rules: {
AccountNumber: {
required: "#Pin:checked",
regex: "[A-Za-z0-9\-]+",
invalidPin: true
}
},
messages: {
AccountNumber: {
required: "<br/>Please Enter Account Number",
regex: "<br/>Please Enter valid Account Number",
invalidPin: "<br/>Please Enter valid Account Number"
}
}
});