Lasso Soft Inc. > Home

[ks_valid_email]

Linkks_valid_email
AuthorKeith Schuster
CategoryEmail
Version8.x
LicensePublic Domain
Posted06 Jul 2006
Updated07 Jul 2006
More by this author...

Description

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.

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.

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: 
	//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

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft