View RSS Feed


Form Validation Using JavaScript

Rating: 5 votes, 5.00 average.
Click image for larger version. 

Name:	formval.jpg 
Views:	198 
Size:	10.3 KB 
ID:	182Click image for larger version. 

Name:	formval.jpg 
Views:	198 
Size:	10.3 KB 
ID:	182
Program to Implement form validation using javascript
		<title>FORM VALIDATION</title>
		<script type="text/javascript">
		function f1(f)
				var a,b,c,d;
					alert("username field can not remain blank");
					return false;
					alert("password should be of max of 8 characters");
					return false;
					alert("password do not match");
					return false;
					alert("invalid email");
					return false;
			return true;

	<body bgcolor=bisque text=black>
	<form name="f" method="post" action="a1.html">
	<center>ENTER USERNAME:: <input type="text" name=t1></center></br>
	<center>ENTER PASSWORD:: <input type="password" name=t2></center></br>
	<center>RETYPE PASSWORD:: <input type="password" name=t3></center></br>
	<center>ENTER EMAIL ID:: <input type="text" name=t4></center></br>
	<center><input type="submit" value="SUBMIT" onClick="return f1(this.form)"><center><br><br>


Submit "Form Validation Using JavaScript" to Digg Submit "Form Validation Using JavaScript" to del.icio.us Submit "Form Validation Using JavaScript" to StumbleUpon Submit "Form Validation Using JavaScript" to Google

Updated 02-27-2011 at 08:04 AM by angad

Web Design


  1. prafic's Avatar
    This is simple and nice too.........
  2. Ram's Avatar
    sometimes simple things works more rapidly
  3. gauthamvit's Avatar
    Very informative. I recently stumbled across http://rindovincent.blogspot.com where there was simple JavaScript program to validate a form. I hope it will be useful for all beginners.

Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.