Currently I am trying to write a code for validation for my site contact info, and I am stuck for 3 hours now on a probably some small problem, but I just can't figure it out.
The problem I have appears in second IF element inside else element, I want to make regex search for numbers [/d] and whitespace [/s] in selected string, but my code always sees only one rule, and ignores the other one.
I guess the mistake is that i didn't write it well, but I can't figure out how. Please give me some pointers where am I making mistake.
if (sFirstname == null || sFirstname == "") {
alert("First name must be filled out");
return false;
}
else {
if (/\d/, /\s/i.test(sFirstname)){
alert("Only Letters can be used in First name")
return false;
}
else {
alert("true")
return true;
}
}