Phone Number Validation
Jeff Honken
jhonken at x12.info
Wed Feb 15 12:33:32 EST 2006
I'm trying to validate a date. I've been playing with the below code
but I can't get it to verify a correct phone number. Can anyone steer
me in the correct direction on how to verify a phone number in a field
for the correct format? Jeff
--> Function
function CheckPhone pPhoneToCheck
if pPhoneToCheck is
matchText(pPhoneToCheck,"([0-9][0-9][0-9])-([0-9][0-9][0-9])-([0-9][0-9]
[0-9][0-9])")
then
return pPhoneToCheck
else
return "Bad Phone"
end if
end CheckPhone
-->End of Function
--> Code in Filed
on closeField
put CheckPhone(me) into Ewr
if Ewr is "Bad Phone" then
answer "The Telephone Number you entered must be in the format of
000-000-0000"
put "" into me
focus on me
break
ELSE
Answer "OK Good Number"
END IF
end closeField
More information about the use-livecode
mailing list