Hello,
I created a form to validate form fields for empty fields and check ssn. When I added the set focus() on, it does not work.
Can you help please to see why my does not work? it worked without the set focus() on.
thanks.
var err = 0
function ckform(){
if (document.form.Name.value=="") {
msgbox = msgbox + "\n Please enter your Name.";
if err == 0 {
document.form.Name.focus();
err = err + 1;
}
}
function chfr() {
var SSNvalue = document.form.SSN.value;
if(isNaN(SSNvalue) || SSNvalue.length != 9) { // not a number or length not equal to 9
msgbox = msgbox + "\n Please enter a valid ssn in corect format.";
if err == 0 {
document.form.SSN.focus();
err = err + 1;
}
}
}