1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
Define_tag(
'email',
-namespace='valid_',
-Priority='replace',
-required='compare',
-type=string,
-required='email',
-type=string,
-optional='email2Compare',
-type=string,
-criteria=(#compare == 'Y' || #compare == 'N')
);
//Updated By Keith Schuster 7/6/2006.
//Based on tag created by Alex Pilson found here:<http://tagswap.net/valid_email2>
//Added to Alex's tag is the ability to pass two email addresses for comparison before validation on the first
//This tag is ment to handle form submission where the user is asked to enter the email twice to ensure
//accuracy AND validate the address
//Param:"compare" - this is set to 'Y' => To compare two addresses and validate or 'N' => just validate one address
//Param:"email" - This is the address that will be validated
//Param:"email2Compare" - This is the address that will be compared to "email"
//Usage:
// valid_email:'Y','keith@aol.com','email2Compare@aol.com';' => compare and validate
// valid_email:'N','keith@aol.com';' => just validate the email address
local('result' = true);
Define_Tag('checkThisEmail',-required='thisEmail');
local('result' = true);
(#thisEmail == NULL || #thisEmail == '') && (#thisEmail->(EndsWith:'.') && #thisEmail !>> '@') ? return:false;
#thisEmail->trim;
#thisEmail !>> '@' ? return:false;
#thisEmail->(EndsWith:'.') ? return:false;
#thisEmail->(EndsWith:'@') ? return:false;
Local('illegal' = (array: '`','~','!','$', '#','^','&','*','(',')','+','=',' '));
Local('theSplit' =#thisEmail->(split:'@'));
#theSplit->(size) != 2 ? return:false;
#theSplit->second == '' ? return:false;
#theSplit->second !>> '.' ? return:false;
// Loop through all the the illegal characters
iterate:#illegal, local:'i';
#thisEmail->(Contains:#i) ? return:false;
/iterate;
return:#result;
/Define_tag;
if:#compare == 'Y';
if:#email == #email2Compare;
return:checkThisEmail:#email;
else;
return:'No Match';
/if;
else;
return:checkThisEmail:#email;
/if;
/Define_tag;
|