[ks_valid_email]

Description

Link: [ks_valid_email]
Author: Keith Schuster
Category: Email
Version: 8.x
License: Public Domain
Posted: Jul. 06, 2006
Updated: Jul. 07, 2006
More by this author...
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, as would be done during form submission, before the first address is validated.

Parameters

-compare string, required Set to 'Y' => To compare two addresses and validate or 'N' => just validate one address
-email string, required This is the address that will be validated
-email2Compare string, optional This is the address that will be compared to "email"

Sample Usage

Compare and Validate
valid_email:'Y','keith@aol.com','email2Compare@aol.com';

Just validate the email address
valid_email:'N','keith@aol.com';
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
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;

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net