function ValidateProForm()
{
var sErrStr = "";
var sFieldName = "";
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
//str=document.getElementById("email_help").value;
if(trim(document.getElementById("Pro_Fname").value)=="")
{
sErrStr +="- First Name \n";
if(sFieldName == "")
sFieldName="Pro_Fname";
}
if(document.getElementById("Pro_Email").value=="")
{
sErrStr +="- Email-Address \n";
if(sFieldName == "")
sFieldName="Pro_Email";
}
else if(document.getElementById("Pro_Email").value!='')
{
if(emailPattern.test(document.getElementById("Pro_Email").value)==false)
{
alert("Invalid Email Address");
document.getElementById("Pro_Email").focus();
return false;
}
}
if(trim(document.getElementById("Pro_Request").value)=="")
{
sErrStr +="- Post your Description \n";
if(sFieldName == "")
sFieldName="Pro_Request";
}
if (sErrStr != "")
{
alert("Please Enter the Following fields: \n\n"+sErrStr);
document.getElementById(sFieldName).focus();
return false;
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.