JavaScript
  Home arrow JavaScript arrow Page 2 - Checking Online Forms with the Validator j...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Checking Online Forms with the Validator jQuery Plug-in
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-10-23

    Table of Contents:
  • Checking Online Forms with the Validator jQuery Plug-in
  • A simple online form
  • Validating the HTML form
  • Validating web forms selectively

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Checking Online Forms with the Validator jQuery Plug-in - A simple online form


    (Page 2 of 4 )

    Of course, before I attempt to show you how to use the Validator jQuery plug-in to validate data submitted through a web form, it's necessary to create the form. So, for this particular project I'm going to build a simple one that will contain three basic fields, which will allow users to enter their first and last names, and their email addresses. In short, this one will be a typical contact form, which you've probably coded hundreds of times before.

    This sample online form looks like this: 

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <title>Sample web form</title>

    </head>

    <body>

    <form id="sampleform" method="post" action="process_form.php">

    <p>First Name <input type="text" name="fname" class="required" /></p>

    <p>Last Name <input type="text" name="lname" class="required" /></p>

    <p>Email Address <input type="text" name="email" class="required" /></p>

    <p><input type="submit" value="Submit" /></p>

    </form>

    </body>

    </html>

    As you can see, the structure of the online form listed above is extremely simple, composed of three text fields named "fname," "lname" and "email" respectively. In addition, I decided to assign a "required" CSS class to those fields, in case they need to be styled accordingly, but for the moment I'll keep them looking pretty rudimentary.

    So far, everything looks good; the scenario has been properly set up to start using the Validator plug-in at a basic level. In this case, all of the fields that compose the above contact form will need to be filled in by users, meaning that it'll be necessary not only to link the plug-in to the sample form, but configure it for checking that each field hasn't been left empty.

    The details of this process will be covered in the following section, so click on the link shown below and keep reading. 

    More JavaScript Articles
    More By Alejandro Gervasio


       · The Validator jQuery plug-in makes client-side form validation a fun and easy...
     

    JAVASCRIPT ARTICLES

    - Using jQuery to Preload Images with CSS and ...
    - Using Client-Side Scripting to Preload Image...
    - Removing Non-Semantic Markup when Preloading...
    - Using the Display CSS Property to Preload Im...
    - Preloading Images with CSS and JavaScript
    - Scaling and Moving Web Page Elements with th...
    - Fading, Hiding and Sliding HTML Elements wit...
    - Toggling CSS Properties with the GX JavaScri...
    - Cancel, Queue and Pause Animations with the ...
    - Producing Elastic Effects with the GX JavaSc...
    - Moving Divs Diagonally with the GX JavaScrip...
    - Moving Elements Vertically and Horizontally ...
    - Making Bouncing Effects in Parallel with the...
    - Creating Bouncing Effects with the GX JavaSc...
    - Manipulating Background Colors with the GX J...







    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 7 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek