validate telephone number

Results 1 to 2 of 2

Thread: validate telephone number

  1. #1
    Join Date
    Dec 1969

    Default validate telephone number

    Hi, I want a server-side script to validate and and change a telephone number. I need to make it international but without the + sign. e.g. If the user types in 07968 498 257 or any other commonly used format the script will change the number to 447968498257, adding the international code, removing the first 0 and removing the spaces.<BR><BR>Any ideas welcome

  2. #2
    Eddie Campbell Guest

    Default RE: validate telephone number

    This will sort out a lot of phone numbers into the format you want, but not all. What if they enter "020 8564 1234/1245"? Also will your numbers always be UK numbers, or will you need to put other international dialing codes in place. And another thing, if you have foregin numbers, the spanish use a 9 instead of the leading 0 (or at least they used to).<BR>In terms of validation, what do you want to test?<BR>&#060;%<BR>Mystr = "07968 498 257"<BR>Response.write MyStr & "<BR>"<BR>MyStr=Replace(MyStr," ","")<BR>MyStr=Replace(MyStr,"-","")<BR>MyStr=Replace(MyStr,".","")<BR>If Left(MyStr,1) = "0" then<BR> MyStr=Right(MyStr,Len(MyStr)-1)<BR>End If<BR>If Left(MyStr,2) &#060;&#062; "44" then<BR> MyStr="44" & MyStr<BR>End If<BR>Response.write MyStr<BR><BR>%&#062;<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts