Commit Graph

11 Commits

Author SHA1 Message Date
Erik van Konijnenburg
5b114e10db Fix min/max validation. Closes gh-666. Fixes #648
In 1.10.0, min/max validation was supported for input type="text",
where min/max were interpreted as numbers.  This means min/max
for date would not work: min="2012-02-13" was interpreted as min="Not a Number".

In 1.11.0, min/max were no longer converted to numbers.  This means
min/max for dates worked, but min/max for numbers failed:
"50" < "150" < "1000" does not hold.

For an example, see http://jsbin.com/awokex/3

This commit makes the behaviour of min/max dependent on input type:

 * input type=text (or not type attribute) has numeric min/max, as in 1.10.0
 * input type=date has working min/max for type date;
   on mobile browsers you also get a date picker,
   plus the browser may reject invalid dates before
   javascript gets a chance to complain.
 * input type=number or range get numeric min/max,
   plus numeric keypad or slider on mobile browsers,
   plus browser may reject invalid input before javascript
   gets a chance to complain

Allowing use of min/max with type=number/range/date is important
for mobile browsers, where the numeric keypad or date picker
make the input much easier to use than a generic text input field.
In this situation jquery-validate remains necessary to support
older browsers that do not do input validation based on type
and min/max.

For situations where numeric input should be validated by jquery
without giving the browser a chance to validate the input format,
input type=text in combination with min/max can be used, as in 1.10.0.
2013-03-20 13:17:58 +01:00
Bogdan Litescu
4a134b6db6 Fixed 'messages' coming up as a rule and causing an exception after being updated through rules("add"). Closes gh-670, fixes #624 2013-03-20 12:49:25 +01:00
jzaefferer
4a51e71c6f Fix typos 2013-03-07 13:55:35 +01:00
Alexander I. Zaytsev
69831a08cf Remove clearing as numbers of min, max and range rules. Fixes #455. Closes gh-528.
These rules are fully suitable to check any comparable JavaScript objects such as strings or dates. Also clearing prevents HTML5 date input fields to work when these rules are coming from HTML.
2013-02-04 12:11:10 +01:00
Jörn Zaefferer
b5cd04e327 Lint test files 2013-01-31 00:28:13 +01:00
Max Lynch
6df33a8ccc Remove support for metadata plugin, replace with data-rule- and data-msg- (added in 907467e8) properties. 2012-11-23 14:39:37 +01:00
Jörn Zaefferer
c243e8ee88 Update testsuite to use equal and deepEqual. Fix tests that the fix for #219 (732f5ff04b) broke. The element method now returns true for dependency-mismatch, that's fine. 2012-02-24 17:58:46 +01:00
Christian Koller
2d06d14dab Fixed #194 - Required as attribute fails if jQuery>=1.6 - Use .prop instead of .attr
Plus whitespace cleanup for test/index.html and test/rules.js
2011-09-20 19:14:26 +02:00
jzaefferer
10d0d9b15f Fixed the broken testsuite, with an update to current QUnit. A few tests still broken. 2011-01-28 17:15:32 +01:00
jzaefferer
5bb2441f04 CRLF conversions 2010-05-05 15:52:04 +02:00
Jörn Zaeffferer
ce7c5baa4e 2009-08-01 11:54:55 +00:00