<html>
<head>
<script>
function validation()
{
var name=document.RegistrationForm.Name;
if( name.value == "" )
{
alert( "Please Enter the name!" );
name.focus() ;
return false;
}
var email = document.RegistrationForm.EMail.value;
atpos = email.indexOf("@");
dotpos = email.lastIndexOf(".");
if (atpos < 1 || ( dotpos - atpos < 2 ))
{
alert("Please enter correct email ID")
document.RegistrationForm.EMail.focus() ;
return false;
}
var password=document.RegistrationForm.Password;
var password1=document.RegistrationForm.Password1;
if (password.value == "" || isNaN( password.value ))
{
window.alert("Please enter your password");
password.focus();
return false;
}
if(password1.value=="")
{
window.alert("Please enter the repeat password");
password1.focus();
return false;
}
var psd=document.RegistrationForm.Password.value;
var psd1=document.RegistrationForm.Password1.value;
if(psd!=psd1){
alert("password must be same!");
return false;
}
}
</script>
</head>
<body>
<form name="RegistrationForm" onsubmit="return(validation());">
<h1>Registration Form</h1>
<p><b>Name: </b>
<input type="text" name="Name"></p>
<p for="email"><b>Email: </b>
<input type="text" name="EMail"></p>
<p for="password"><b>Password: </b>
<input type="password" name="Password" ></p>
<p for="password1"><b>Repeat Password: </b>
<input type="password" name="Password1" ></p>
<input type="submit" value="Register" name="Submit">
<div class="container">
<p>Already have an account? <a href="#">Sign in</a>.</p>
</div>
</form>
</body>
</html>
Program to implement Registration Form Validation.

Nitin Pandit
With over 10 years of vast development experience with different technologies, Nitin Pandit is Microsoft certified Most Valued Professional (Microsoft MVP) with a rich skillset that includes developing and managing IT/Web-based applications in different technologies, such as – C#.NET, ADO.NET, LINQ to SQL, WCF, and ASP.NET 2.0/3.x/4.0, WCF, WPF, MVC 5.0 (Razor), and Silverlight, along with client-side programming techniques, like jQuery and AngularJS. Nitin possesses a Master’s degree in Computer Science and has been actively contributing to the development community for its betterment. He has written more than 100 blogs/articles and 3 eBooks on different technologies to help improve the knowledge of young technology professionals. He has trained more than one lakh students and professionals, as a speaker in workshops and AppFests, conducted in more than 25 universities in North India.
