Hello,
On customer registration form I need only 5 digit numeric value from customer but customers are able to put some big random email address in that field. Is there any validation from backend side that can stop this? I have added this code on submit click but still I don't understand how are they able to enter it.
$('#AccountFrm_postcode').attr('maxlength', '5');
$("#AccountFrm_postcode").on("keypress keyup blur",function (event) {
$(this).val($(this).val().replace(/[^\d].+/, ""));
if ((event.which < 48 || event.which > 57)) {
event.preventDefault();
}
});
var zipCode = $('#AccountFrm_postcode').val();
if(zipCode.length < 5){
alert("Please enter 5 digit Zip Code");
event.preventDefault();
$('#AccountFrm_postcode').focus();
}