asked on
function isdigit(test) {
if (test == "0" || test == "1" || test == "2" ||
test == "3" || test == "4" || test == "5" ||
test == "6" || test == "7" || test == "8" ||
test == "9" || test == ".")
return true;
else {
return false;
}
}
// Function to determine if a field is numeric
function isnumeric(field) {
len = field.length;
for (i = 0; i < len; i++)
if (isdigit(field.charAt(i)) == false) {
return false;
}
return true;
}
pp6 = pp5.trim();
alert("pp6 = " + pp6);
pnl = pp6.length;
alert("pnl = " + pnl);
if (pnl > 11) {
alert ("Invalid phone number.");
return false;
}
if (! isnumeric(pp6)) {
alert ("pp6 not numeric");
alert ("Invalid phone number.");
return false;
}
In a specific case, pp5 is 6198559182