We didn't cover the use of regular expressions for input validation in this module. But many students used them anyway. Here's the code used by Vodafone to validate the e-mail address. See if you can figure what kind of e-mail addresses it will take, any maybe bag one of those Nokia Lumia 800s that they have run out of in the shops.
var EmailTxtBoxCheck = function(controlToValidate)
{
var RE_EMAIL = /^[a-zA-Z][a-zA-Z0-9\_\-\.]*\@[a-zA-Z0-9\-]*\.[a-zA-Z]{2,4}\.[a-zA-Z]{2,4}$/;
if (RE_EMAIL.test(controlToValidate.value))
{
//HideError(controlToValidate);
return true;
}
else
{
//ShowError(controlToValidate);
return false;
}
}
1 comment:
Hello.It will take email "colin.manning@cit.ie.ie"
Congratz for voodafone! MT
Post a Comment