Validate/Format Phone Numbers
The purpose of this script is to format and validate Telephone Numbers in a form field. The script strips all non-numeric characters and then validates that the remaining characters are sufficient to make up a valid phone number. If there remaining string is 10 characters in length, the script then formats by adding a "-" after the third and sixth digits. Resulting in a mask like ###-###-####.