JavaScript
  Home arrow JavaScript arrow Using Minlength and Maxlength with the Val...
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

Using Minlength and Maxlength with the Validator jQuery Plug-in
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-10-29

    Table of Contents:
  • Using Minlength and Maxlength with the Validator jQuery Plug-in
  • Review: checking web forms with the Validator jQuery plug-in
  • Specifying minimum lengths for all fields in a form
  • Specifying maximum lengths for all fields in a web form

  • 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


    Using Minlength and Maxlength with the Validator jQuery Plug-in


    (Page 1 of 4 )

    If you don't know how to make your web site check web forms in the client, it's time you learned about the Validator jQuery plug-in. It's a compact and powerful application based on the popular jQuery library that will let you perform all sorts of clever validations on online forms in a truly no-brainer fashion, without spending endless hours coding complex JavaScript checking functions to check user-supplied data. This is the second part of a seven-part series that examines this plug-in in detail.

    Naturally, if you’ve already read the introductory article of this series, then you have a pretty clear idea of how to use the Validator plug-in in for verifying data collected through an HTML form. In that particular tutorial I discussed how to use the “validate()” method (actually, the workhorse of the plug-in) to check a basic contact form composed of the typical “First Name,” “Last Name” and “Email” fields.

    As you’ll surely remember, in the first case the “validate()” method was attached to the targeted form, thus performing a basic validation process on all of the pertinent fields, while in a second example the method was called with a “rules” argument, which permitted us to specify much more selectively which fields should be properly checked.

    However, using a plug-in that only checks for empty strings on a selected web form is pretty useless, particularly in cases where a stricter validation process is required. Fortunately, the Validator plug-in comes with a neat set of features that allow it to do a few interesting things, such as checking if the data entered into a specific field is a valid URL, or if it’s a correctly-formatted email address, and much more, actually.

    So, in this second installment of the series, I’ll be talking a close look at the plug-in’s “minlength” and “maxlength” arguments, which as their names suggest, come in handy for verifying individually if the text entered into a determined field contains at least a certain number of characters, and if it exceeds a specified length.

    Now, it’s time to learn how to work with these useful parameters when validating online forms. Let’s get going!

    More JavaScript Articles
    More By Alejandro Gervasio


       · This second installment of the series takes a close look at the plug-in’s...
     

    JAVASCRIPT ARTICLES

    - Comparing Fields and Customizing Error Messa...
    - Checking Numbers and File Extensions with jQ...
    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in







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