MimUK
asked on
Email Address Validation
I need to amend a function that will prevent users from entering an @gmail or @msn or @yahoo email address to a web based CRM application
The code attached works fine and warns if the format of the address is not correct.
However, based on this script, could someone help with changes required to prevent the above from happening.
Many thanks
The code attached works fine and warns if the format of the address is not correct.
However, based on this script, could someone help with changes required to prevent the above from happening.
Many thanks
function emailvalidation(x,y)
{
if (x.length>0)
{
apos=x.indexOf("@");
dotpos=x.lastIndexOf(".");
lastpos=x.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
{
Valid = false;
ErrorStr = CRM.GetTrans("colnames",y)+ " ["+x+"] "+ CRM.GetTrans("GenCaptions","BadMailAddress");
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great Thanks.
Works a Treat
Works a Treat
ASKER
Having deployed the script...
We have found that if the user enters @MSN or @Gmail the validation doesn't work as the expression is case sensitive.
We have found that if the user enters @MSN or @Gmail the validation doesn't work as the expression is case sensitive.
Depends how clever you wanted to be with it.