1<form onsubmit = "event.preventDefault(); myValidation();">
2
3<script>
4 function myValidation()
5{
6 if(check if your conditions are not satisfying)
7 {
8 alert("Oops! Validation failed!");
9 returnToPreviousPage();
10 return false;
11 }
12 alert("Validations successful!");
13 return true;
14}
15 </script>