How to check the validation of edittext for pan card like \"ABCDE1234F\". I am confused how to check the the validation for this. Please help me guys. I will appreciate any kind
Try this one
$(document).ready(function() {
$.validator.addMethod("pan", function(value1, element1) {
var pan_value = value1.toUpperCase();
var reg = /^[a-zA-Z]{3}[PCHFATBLJG]{1}[a-zA-Z]{1}[0-9]{4}[a-zA-Z]{1}$/;
var pan = {
C: "Company",
P: "Personal",
H: "Hindu Undivided Family (HUF)",
F: "Firm",
A: "Association of Persons (AOP)",
T: "AOP (Trust)",
B: "Body of Individuals (BOI)",
L: "Local Authority",
J: "Artificial Juridical Person",
G: "Govt"
};
pan = pan[pan_value[3]];
if (this.optional(element1)) {
return true;
}
if (pan_value.match(reg)) {
return true;
} else {
return false;
}
}, "Please specify a valid PAN Number");
$('#myform').validate({ // initialize the plugin
rules: {
pan: {
required: true,
pan: true
}
},
submitHandler: function(form) {
alert('valid form submitted');
return false;
}
});
});