Home arrow JavaScript arrow Using Minlength and Maxlength with the Validator jQuery Plug-in
JAVASCRIPT

Using Minlength and Maxlength with the Validator jQuery Plug-in


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.

Author Info:
By: Alejandro Gervasio
Rating: 3 stars3 stars3 stars3 stars3 stars / 3
October 29, 2009
TABLE OF CONTENTS:
  1. · Using Minlength and Maxlength with the Validator jQuery Plug-in
  2. · Review: checking web forms with the Validator jQuery plug-in
  3. · Specifying minimum lengths for all fields in a form
  4. · Specifying maximum lengths for all fields in a web form

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Using Minlength and Maxlength with the Validator jQuery Plug-in
(Page 1 of 4 )

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!


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials