Wednesday, May 9, 2012

jQuery validate

How to check your forms in 5 mins or less?

I myself like to use jQuery Validate why because its easy to set up ill give an example below:

The first step is to include at the top of your page(You need to have jQuery in order to make jQuery validate work ):

<script type="text/javascript" src=""></script> 

Second step is to have a form:

<form  id="commentForm" method="get" action="">
   <legend>A simple comment form with submit validation and default messages</legend>
     <label for="cname">Name</label>
     <em>*</em><input id="cname" name="name" size="25" class="required" minlength="2" />
     <label for="cemail">E-Mail</label>
     <em>*</em><input id="cemail" name="email" size="25"  class="required email" />
     <label for="curl">URL</label>
     <em>  </em><input id="curl" name="url" size="25"  class="url" value="" />
     <label for="ccomment">Your comment</label>
     <em>*</em><textarea id="ccomment" name="comment" cols="22"  class="required"></textarea>
     <input class="submit" type="submit" value="Submit"/>

Third step is to define the form:


1 comment:

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Best Web Hosting Coupons