Validating Ranges, Emails, and URLs with jQuery`s Validator Plug-in
In this fourth part of a seven-part series on the jQuery Validator plug-in, I explain how to use the “range,” “email” and “url” options provided for checking numeric ranges, URLs and email addresses. Using these arguments is an intuitive process that can be learned in a very short time.
Validating Ranges, Emails, and URLs with jQuery`s Validator Plug-in - Review: the rangelength, min and max options (Page 2 of 4 )
Before I proceed to explain how the Validator plug-in can be used for checking numeric ranges, URLs and email addresses, I'm going to reintroduce the examples created in the previous article. They showed how to validate length ranges, as well as minimal and maximal values.
Having said that, here’s the full source code corresponding to the examples in question:
(example on using the ‘rangelength’ option)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
As you’ll surely recall, the “rangelength” option can be used to find out whether or not data entered into a specific form field is within a determined range of lengths, as shown in the first example. The other two code samples simply show how to make use of the “min” and “max” arguments to validate independently minimal and maximal values. That was really easy to grasp, wasn’t it?
Having reviewed the examples developed in the previous part of the series, I'm going to explain how to use the Validator plug-in for checking entire numeric ranges (the equivalent process to using the “min” and “max” options simultaneously), as well as email addresses and URLs.
To learn how to perform all of these useful tasks with Validator, you’ll have to click on the link shown below and keep reading.