java script validation in client side with explanation and give an example for 3tier achitecture with simple examples
function ValidateEmail(mail) { var objVal = document.getElementById(mail).value; var obj = document.getElementById(mail); var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; //var address = document.getElementById[email].value; if (reg.test(objVal) == false) { alert("You have entered an invalid email address!"); obj.classList.add("cui-requredField"); obj.focus(); return (false); } else obj.classList.remove("cui-requredField"); return (true); }