Valdating Email Address

Got a problem you cannot solve? Try here.
swarovski
Posts: 109
Joined: Mon Apr 16, 2007 8:32 pm

Valdating Email Address

Postby swarovski » Mon Apr 16, 2007 8:41 pm

I have put a Email Address textbox in the Registration Information screen for my setup project.

How do I validate it?
Simple rules like someone@company.com is enough.

must have @ and .

Thank you!

Fig
Posts: 22
Joined: Tue Aug 15, 2006 12:27 pm

Postby Fig » Tue Apr 17, 2007 10:32 am

This is a bit simplistic (doesn't check for invalid characters) but try:

Set Variable EMAILFAIL to TRUE
Set Variable EMAILNAME to
Set Variable EMAILDOMAIN to
Comment: Check for invalid space character (pattern in next statement is a space)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILDOMAIN Equals
Comment: Check for strings on each side of the asterisk (pattern in next Parse String is an asterisk)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILNAME not Equals
if Variable EMAILDOMAIN not Equals
Comment: Check for a period in the domain (pattern in next Parse String is a period)
Set Variable EMAILDOMAIN_1 to
Set Variable EMAILDOMAIN_2 to
Parse String $EMAILDOMAIN$ into Variables EMAILDOMAIN_1 and EMAILDOMAIN_2 (Split at last occurrence of pattern)
if Variable EMAILDOMAIN_1 not Equals
if Variable EMAILDOMAIN_2 not Equals
Set Variable EMAILFAIL to FALSE
end
end
end
end
end
if Variable EMAILFAIL Equals True
Comment: Take action on the invalid e-mail address
end


Where $EMAIL$ is the variable containing the email address to test.
... Fig

swarovski
Posts: 109
Joined: Mon Apr 16, 2007 8:32 pm

Postby swarovski » Sun Jun 10, 2007 11:05 pm

Thanks a lot Fig. It really helps!

btw, the pattern in the 2nd parse should be: "@"


Fig wrote:This is a bit simplistic (doesn't check for invalid characters) but try:

Set Variable EMAILFAIL to TRUE
Set Variable EMAILNAME to
Set Variable EMAILDOMAIN to
Comment: Check for invalid space character (pattern in next statement is a space)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILDOMAIN Equals
Comment: Check for strings on each side of the asterisk (pattern in next Parse String is an asterisk)
Parse String $EMAIL$ into Variables EMAILNAME and EMAILDOMAIN (Split at first occurrence of pattern)
if Variable EMAILNAME not Equals
if Variable EMAILDOMAIN not Equals
Comment: Check for a period in the domain (pattern in next Parse String is a period)
Set Variable EMAILDOMAIN_1 to
Set Variable EMAILDOMAIN_2 to
Parse String $EMAILDOMAIN$ into Variables EMAILDOMAIN_1 and EMAILDOMAIN_2 (Split at last occurrence of pattern)
if Variable EMAILDOMAIN_1 not Equals
if Variable EMAILDOMAIN_2 not Equals
Set Variable EMAILFAIL to FALSE
end
end
end
end
end
if Variable EMAILFAIL Equals True
Comment: Take action on the invalid e-mail address
end


Where $EMAIL$ is the variable containing the email address to test.


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 145 guests