Commit Graph

31 Commits

Author SHA1 Message Date
Artyom Skrobov
350f6aea8b Core: fix validation for input type="date" (#2360)
* Core: Fix code style to pacify jscs

* Core: Fix validation for input type="date" (#2359)

Test case contributed by @nenadvicentic

Co-authored-by: Kieran <kieran@supportpal.com>
2022-05-06 11:26:19 +01:00
Brahim Arkni
bc5e651a36 Test: Cast empty data attributes to 'true' 2018-06-19 14:07:11 +01:00
Brahim Arkni
18b8497db4 Test: required method should return false for null & undefined values 2017-09-02 18:27:51 +01:00
Brahim Arkni
cac8f05e6b Core: Allow the normalizer to return any value
Fixes #2049
2017-09-02 17:43:15 +02:00
Brahim Arkni
a88ae88c6e Core: Add support for defining a global normalizer 2016-12-25 16:12:45 +01:00
Brahim Arkni
8fe4a90185 Tests: Upgrade QUnit to 2.0.
Closes #1777. #1681.
2016-07-22 17:56:18 +02:00
Jordan Clark
38310a142e Core: Fix error when calling $.fn.rules() on a non-form element.
Closes #1771. Fixes #1770.
2016-06-14 17:39:40 +02:00
Markus Staab
bb87ef02d5 Tests: Calling .rules() on an empty jQuery object results in an error.
Refs #1706
2016-02-12 16:13:55 +01:00
Brahim Arkni
7d74fc4157 Core: Validation fails to trigger when next field is already filled out
This change fix the bug when used with remote rule, it's already fixed
with other rules in commit 737630e788

Ref #1508
2016-01-18 15:25:23 +00:00
Brahim Arkni
729823a807 All: Fixed code style issues 2015-10-30 23:55:26 +00:00
Brahim Arkni
abe6810444 Core: Added normalizer
The user can change the value of an element before validating
the element in question. The new value will be then used by
the associated methods instead of the `real one`.

Closes #1602
2015-10-23 20:58:36 +01:00
Brahim Arkni
842e7ff5dd Test: Fix misuse of equal method & some spacing issues. 2015-09-25 16:54:38 +01:00
Jörn Zaefferer
bc4223806a Core: Remove unused removeAttrs method
jQuery Core supports removing space-separated attributes since 1.7,
and its not used in the plugin anyway.

Fixes #1124
2015-06-30 17:01:29 +02:00
Jörn Zaefferer
fe14d00a1d Core: Allow 0 as value for autoCreateRanges
Closes #1293
2014-10-14 16:25:06 +02:00
Nick Schonning
d0c56e005e Build: Run JSCS against tests 2014-05-27 00:08:54 -04:00
Damian Mooyman
e5e70b1632 Core: Use aria-describedby for non-label elements
Fixes #900
Closes #1083
2014-05-21 11:39:51 +02:00
Jörn Zaefferer
a0ed6f8111 Core: Fix normalization for rangelength attribute value
This regressed at some point, probably when rules-as-data-attributes where
introduced, since those are automatically parsed as JSON. For the unprocessed
attributes, the array brackets have to be removed.

Also fixes the milk demo, which specified rangelength as the message, instead of
minlength, which it actually uses.

Fixes #1087
2014-04-29 20:41:18 +02:00
Nick Schonning
3e09fcb719 JSHint: Apply onevar to tests 2014-01-23 18:14:23 -05:00
Nick Schonning
313fd1dd3f JSHint: Remove unused parameters
- Fix double quoting in mockjax response to use doublequotes again
2014-01-23 17:45:37 -05:00
Nick Schonning
91fa266cfe JSHint: Replace single for double quotes in tests 2014-01-23 16:16:53 -05:00
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