Skip to content

Instantly share code, notes, and snippets.

@dave-jay
Created November 23, 2015 17:32
Show Gist options
  • Save dave-jay/cc9976ca0c9fada59e49 to your computer and use it in GitHub Desktop.
Save dave-jay/cc9976ca0c9fada59e49 to your computer and use it in GitHub Desktop.
phone_validation
if (theType == 'Phone') {
if(theFieldValue.charAt(0) == '1'){
alert("The number should not start with 1");
return false;
}
if (theFlag) {
// Required Entry
theRE = eval("/^[0-9]{10,10}$/");
} else {
theRE = eval("/^$|^[0-9]{10,10}$/");
}
if (theRE.test(theFieldValue)) {
} else {
alert("Must be ONLY 10 number digits with no prefix. Area code and numbers only..");
eval(theField + ".value = ''");
retVal = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment