Another Form Validation Question...

wxdqz

New Member
How would I go about validating this field so that it only accept exactly 12 numbers

if (document.form.idnum.value=="") {
window.alert ("Please enter your ID Number!");
document.form.idnum.focus();
return false;
}

if (isNaN(document.form.idnum.value)) {
window.alert ("Your ID Number Must be Numerical and contain 12 Digits!");
document.form.idnum.focus();
return false;
}

hte form validates ok at present for a null value and a numerical value but i would like it to validate for 12 only as well... TIA
 
Back
Top