function check()
{
if(document.getElementById("<%=txtfname.ClientID%>").value == "")
{
alert ('Please enter first name');
return false;
}
else
{
if(document.getElementById("<%=txtlnm.ClientID%>").value == "")
{
alert ('Please enter last name');
return false;
}
else
{
if(document.getElementById("<%=txtemail.ClientID%>").value == "")
{
alert ('Please enter email ID');
return false;
}
else
{
if(emailValidator(document.getElementById("<%=txtemail.ClientID%>"), "Invalid EmailID"))
{
return true;
}
else
{
if(document.getElementById("<%=txtpswrd.ClientID%>").value == "")
{
alert ('Please enter password');
return false;
}
else
{
var psword = document.getElementById("<%=txtpswrd.ClientID%>");
if(passwordValidator(psword,"Invalid Password. Enter Password as 4 digit birth year and last 4 digits of SSN "))
{
return true;
}
else
{
return false;
}
}
}
}
}
}
}
}
function emailValidator(elem, helperMsg)
{
var emailExp = /\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
if (elem.value != "")
{
if(elem.value.match(emailExp))
{
}
else
{
alert(helperMsg);
elem.focus();
return false;
}
}
}
function passwordValidator(elem, helperMsg)
{
var passwordExp = /^[0-9]+$/;
if(elem.value != "")
{
if(elem.value.match(passwordExp))
{
return true;
}
else
{
alert(helperMsg);
elem.focus;
return false;
}
}
}
Showing posts with label JS Validation no use to regular field validation in VS2005. Show all posts
Showing posts with label JS Validation no use to regular field validation in VS2005. Show all posts
Tuesday, March 4, 2008
Subscribe to:
Posts (Atom)