Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Email addresses?
Message
From
21/04/2006 11:16:04
 
 
To
21/04/2006 03:19:23
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
01115200
Message ID:
01115410
Views:
12
>>Suppose we wanted to provide a textbox that would contain a person's email address, and we want the user to be able to double click the address and launch their email client with a new message addressed t the person from the table as if it were a hyperlink or mailto on a webpage. I could do this with the double click event of the textbox and automation code to launch Outlook or whatever client they are using and reading the value from the textbox. However I was wondering if there is a way to validate the email address so that it turns blue and looks like a clickable address only if it is a good address, similar to how outlook operates when you type an address into a messagebody.
>>
>>I suppose I could write code to test for the '@' sign and legimate domains, but I was wondering if there was an easier way. Can this be done with one of the lesser used field types for example?
>>
>>Thanks for any thoughts.
>
>This is the function I use, I "borrowed" it somewhere, I believe it was made by Tamar Granor.
>Function ValidEmail
>Lparameters lcMail
>Local ox, llReturn
>If Pcount()>0 and Vartype(lcMail)='C'
>  ox=CreateObject('VBScript.RegExp')
>  ox.Pattern= '^[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]' + ;
>    '@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]' + ;
>    '\.[a-zA-Z]{2,4}$'
>  ox.IgnoreCase= .T.
>  ox.Global=.F.
>  llReturn=ox.Test(lcMail)
>  Release ox
>  ox=.NULL.
>EndIf
>Return llReturn
Thanks guys. UT is the greatest!
Previous
Reply
Map
View

Click here to load this message in the networking platform