Validating Digits and Dates with jQuery`s Validator Plug-in
(Page 1 of 4 )
In this fifth installment of a seven-part series on the jQuery JavaScript framework's Validator plug-in, I introduce the “digits” and “date” options. They're very useful for verifying that specified fields of a targeted form contain numeric values and valid dates.
In case you haven’t heard, the Validator plug-in is a powerful jQuery add-on which allows you to validate web form in the client by using some straightforward options. From doing something as simple as checking for empty strings and numeric ranges, to performing more complex validations, such as verifying email addresses and URLs, Validator can really enhance the behavior of web applications that collect user-supplied data through one or multiple HTML forms.
So, if you’re web designer who wishes to master the main features that come with this useful jQuery plug-in, then you should take a close look at this series of articles. In it you’ll find a friendly, hands-on guide that will teach you how to work with the numerous validation options provided by the Validator program.
Naturally, if you've already read the previous chapter of this series, then you'll be familiar with using the plug-in to validate numeric ranges, email addresses and URLs. In that tutorial I explained how to perform all of these tasks by using the “range,” “email” and “url” arguments respectively. Indeed, checking if certain fields of a targeted web form satisfy these specific requirements is a simple process that doesn’t present major problems.
As I said before, though, the Validator plug-in comes bundled with many other checking options that also deserve a closer analysis. Thus, in this fifth episode, I’m going to discuss the usage of the “digits” and “date” arguments. They can help you verify if a field on a form has been filled in only with digits, and if it contains a valid date.
Now, it’s time to leave the preliminaries and learn how to implement these brand new validation options for checking digit-based data. Let’s jump in!
Next: Review: the range, email and url options >>
More JavaScript Articles
More By Alejandro Gervasio