Determines whether the input is a phone number.
Source code
--------------------------------------------------------------------------------
<%
'*************************************** ***************************************
* Do not delete ************** **************************
'
'Copyright notice: Copyright 2000 Nicolas P. ladieu, node I Internet Consulting
'
'This code is free for non-commercial cial use. Any specified cial usage or
'Duplication requires a licensing agreement from the author who may be
'Contacted at the following email address: nick@nodei.com
'
'The author assumes no responsibility for any damage caused by
'Proper or inproper use of this Code.
'
'Http://www.nodei.com
* Do not delete ************** **************************
'*************************************** ***************************************
Function isphone (X)
Dim fieldok
Fieldok = true
For I = 1 to Len (X)
If isnumeric (mid (X, I, 1) = false and mid (X, I, 1) <> "-" And mid (X, I, 1) <> "(" and mid
(X, I, 1) <> ")" then
Fieldok = false
End if
Next
''''' ''' Now strip out chars and see if we have a valid number
For I = 1 to Len (X)
Strcurrentchar = mid (X, I, 1)
'Numbers (0 to 9)
If ASC ("0") <= ASC (strcurrentchar) and ASC (strcurrentchar) <= ASC ("9") then
Strtemp = strtemp & strcurrentchar
End if
'Upper case Chars (A to Z)
If ASC ("A") <= ASC (strcurrentchar) and ASC (strcurrentchar) <= ASC ("Z") then
Strtemp = strtemp & strcurrentchar
End if
Next 'I
X = strtemp
If Len (x) = 10 and left (x, 1) = "1" then
Fieldok = false
End if
If Len (x) <10 then
Fieldok = false
End if
If Len (x)> 11 then
Fieldok = false
End if
Isphone = fieldok
End Function
'''''''''''''''''''''''''''''''''''''''' '''''''
'''''''''''''''''''''''''''''''''''''''' '''''''
%>