function validateEmail(){
var TCode = document.getElementById('email').value;
if(TCode.length==0)
{
email_info.innerHTML="This field is required";
return false;
}
email_info.innerHTML=" ";
var atpos=TCode.indexOf("@");
var dotpos=TCode.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=TCode.length)
{
email_info.innerHTML="Not a valid e-mail address";
return false;
}
email_info.innerHTML=" ";
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("email_info").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","get_email.jsp?email="+TCode,true);
xmlhttp.send();
return true;
}
here is my function which is called on onblur action on a text field which take user email id... what i want to do is to restrict the form from submitting, if email id already exist in database ...I am able to display text that email id already exist but i am not able to restrict user from submitting form even if it already exist what to do?