This is my onsubmit function where i have problem. Hope you guys will help.
function editme() {
var peru=document.editform.user_nam.value;
var mailu=document.editform.user_mai.value;
if (peru==null || peru==""){
alert("Name can't be blank");
return false;
}
if(!/(?=.{0,20}$)\S+\s\S+/.test(peru)){
document.getElementById("eredit").innerHTML="1.Value entered in the Name field is invalid;"
}
if(!/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/.test(mailu)){
document.getElementById("erredit").innerHTML="2.Value entered in the E-mail field is invalid";
}
var aa=document.getElementById("ename").value;
var bb=document.getElementById("email").value;
var cc=document.getElementById("sele").value;
var tab=document.getElementById("myTable");
tab.rows[ind].cells[1].innerHTML=aa;
tab.rows[ind].cells[2].innerHTML=bb;
tab.rows[ind].cells[3].innerHTML=cc;
}
Here, even if there are any validation messages, my values are getting submitted to a table.I want to stop the function where there are error messages. How to do that?