I
ibizara
Please could anyone help I need a validation script on and input field
email to include/exclude the below?
If it is even possible even??
Many Thanks in advanced, Regards, Jason
-----------------------------------------------------------------------------
(Note " * " is NOT a wildcard in the instances below)
include:
a-Z 0-1 * _ - @ a-Z 0-1 _ - . a-Z 0-1
exclude:
*@hsbc.com
*@barclays.com
*@hotmail.com
-----------------------------------------------------------------------------
if (theForm.email.value == "")
{
alert("Please enter a valid email");
theForm.email.focus();
return (false);
}
var checkemail = "@.";
var checkStr = theForm.email.value;
var emailValid = false;
var emailAt = false;
var emailPeriod = false;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkemail.length; j++)
{
if (ch == checkemail.charAt(j) && ch == "@")
emailAt = true;
if (ch == checkemail.charAt(j) && ch == ".")
emailPeriod = true;
if (emailAt && emailPeriod)
break;
if (j == checkemail.length)
break;
}
if (emailAt && emailPeriod)
{
emailValid = true
break;
}
}
if (!emailValid)
{
alert("Please enter a valid email");
theForm.email.focus();
return (false);
}
-----------------------------------------------------------------------------
<form name="whitelist" method="post" action="submit.php">
<input name="email" type="text" id="email"
onblur="lowerCase(this.id)">
<i>[email protected] (*@company.com = anything)</i><br>
<i>Please do <font color="red">NOT</font> add <u>*@hotmail.com</u> ,
only to company domains eg. <u>*@scruttonbland.co.uk</u></i><br>
<i>Also please <font color="red">exclude</font> Bank email addresses
(@rbs.co.uk @barclays.co.uk @lloydstsb.com @hsbc.co.uk @natwest.com)</
i><br>
<input name="submit" type="submit" id="submit" value="Submit">
email to include/exclude the below?
If it is even possible even??
Many Thanks in advanced, Regards, Jason
-----------------------------------------------------------------------------
(Note " * " is NOT a wildcard in the instances below)
include:
a-Z 0-1 * _ - @ a-Z 0-1 _ - . a-Z 0-1
exclude:
*@hsbc.com
*@barclays.com
*@hotmail.com
-----------------------------------------------------------------------------
if (theForm.email.value == "")
{
alert("Please enter a valid email");
theForm.email.focus();
return (false);
}
var checkemail = "@.";
var checkStr = theForm.email.value;
var emailValid = false;
var emailAt = false;
var emailPeriod = false;
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkemail.length; j++)
{
if (ch == checkemail.charAt(j) && ch == "@")
emailAt = true;
if (ch == checkemail.charAt(j) && ch == ".")
emailPeriod = true;
if (emailAt && emailPeriod)
break;
if (j == checkemail.length)
break;
}
if (emailAt && emailPeriod)
{
emailValid = true
break;
}
}
if (!emailValid)
{
alert("Please enter a valid email");
theForm.email.focus();
return (false);
}
-----------------------------------------------------------------------------
<form name="whitelist" method="post" action="submit.php">
<input name="email" type="text" id="email"
onblur="lowerCase(this.id)">
<i>[email protected] (*@company.com = anything)</i><br>
<i>Please do <font color="red">NOT</font> add <u>*@hotmail.com</u> ,
only to company domains eg. <u>*@scruttonbland.co.uk</u></i><br>
<i>Also please <font color="red">exclude</font> Bank email addresses
(@rbs.co.uk @barclays.co.uk @lloydstsb.com @hsbc.co.uk @natwest.com)</
i><br>
<input name="submit" type="submit" id="submit" value="Submit">