Hi everyone,
I needed to create a validation form to allow only 2 domains (basic check if @abd.com or @asd.com and allow those only).
It's plain javascript, can you give me some suggestions?

as of today I do the validation like this:
I needed to create a validation form to allow only 2 domains (basic check if @abd.com or @asd.com and allow those only).
It's plain javascript, can you give me some suggestions?
as of today I do the validation like this:
PHP:
function validateForm()
{
var x=document.getElementById("user_email").value;
var atpos=x.indexOf("@thisdomain.com");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
alert("Please use Your @thisdomain.com email address");
return false;
}
}
Last edited by a moderator: