Function to Check the Format of a Telephone Number Format

People have different thoughts on how they should enter a telephone number into a field on a web form. Some people may enter the number as (nnn) nnn-nnnn and some as nnn-nnn-nnnn and some may omit the area code entirely. Since database formats need to be consistent and field sizes should be kept to a minimum, I found it necessary to write a function to validate telephone number fields before posting them to a database. I prefer the nnn-nnn-nnnn format so that is what I used with this example. This VBScript example accepts a string as the input parameter and returns the Boolean value of True or False.

If you have any comments, questions, or suggestions please fell free to contact us.

 

Sitemap | Privacy Statement

Copyright ©1993-2024 McGrath Electronics, Inc.  All Rights Reserved