Commit Graph

115 Commits

Author SHA1 Message Date
David Weston
747890974c Core: Use jQuery 1.7+ on/off, add destroy method
Replaces validateDelegate method with jQuery's on() method. This raises
the minimum supported jQuery version to 1.7.0, dropping support for 1.6.

Closes #1392
2015-06-17 13:21:11 +02:00
Markus Staab
d937c3198c Tests: Dropped obsolete timeouts, speeding up test runtime.
Fixes #1343
Closes #1496
2015-06-16 19:57:15 +02:00
Brahim Arkni
63cb473c21 Core: Exclude some keyboard keys to prevent revalidating the field
Avoid revalidate the field when pressing one of the following keys
 in 'onkeyup' method:
	Shift       => 16
	Alt         => 18
	Caps lock   => 20
	End         => 35
	Home        => 36
	Left arrow  => 37
	Up arrow    => 38
	Right arrow => 39
	Down arrow  => 40
	Insert      => 45
	Num lock    => 144
	AltGr key   => 225

This helps especially with the remote method, which has a lot of
overhead.

Closes #1411
2015-02-24 19:40:35 +01:00
Markus Staab
64d6d7f751 Core: Do not search the whole DOM for radio/checkbox elements
Fixes #1056
Closes #1064
2015-02-17 12:21:34 +01:00
Jörn Zaefferer
7a632246be Tests: Replace jQuery#size() with #jQuery.length
Apparently newer jQuery versions are removing size(), since length has
been around fover, use that instead.
2015-02-10 20:17:27 +01:00
James
e88f2ef98a Revert "Core: Ignore readonly as well as disabled fields."
This reverts commit 9f4ba10ea7.

Closes #1383
Closes #1300
Ref #1261
2015-01-29 12:19:26 +01:00
Maks3w
a6c2a81d7f Core: Focus invalid element when validating a custom set of inputs
Invalid element is not focused when validate a custom set of inputs and
the last one is a valid input. The issue is element method, via
prepareElement method, via reset method, resets errorList state after
validate each input so the global state of the validator is not
preserved.

Closes #1327
2014-12-16 16:03:49 +01:00
Maks
535033dbd4 Core: Reset element styles when using custom highlight methods
When use a custom highlight functions which for example place the error
class in a different element (like Bootstrap form-group wrapper) this
element are not unhighlighted after resetForm.

Closes #1323
2014-12-02 17:38:58 +01:00
colemanw
9f4ba10ea7 Core: Ignore readonly as well as disabled fields.
Closes #1261
Closes #1262
2014-09-23 13:50:32 +02:00
Jörn Zaefferer
f1c611ed7a Core: Apply ignore setting to all validationTargetFor elements
Previously the filter only applied to checkables. Adds a test and moves
an existing valid() test closer to the others.

Ref #156
Closes #468
2014-09-23 12:23:37 +02:00
Damian Mooyman
ea22f54348 Core: Respect non-error aria-describedby and empty hidden errors
Ref #1083
Closes #1140
2014-06-23 11:17:35 +02:00
Lars Laade
32087b66e6 Test: added click on radio/checkbox test 2014-06-11 23:42:42 +02:00
Nick Schonning
d0c56e005e Build: Run JSCS against tests 2014-05-27 00:08:54 -04:00
Lars Laade
cda5efa487 Core: Added radio/checkbox to delegate click-event
Reverts the accidental change from d319a0da35,
where these event handlers were dropped.

Closes #1126
2014-05-23 14:17:35 +02:00
Damian Mooyman
e5e70b1632 Core: Use aria-describedby for non-label elements
Fixes #900
Closes #1083
2014-05-21 11:39:51 +02:00
Markus Staab
d319a0da35 Core: Register focusin, focusout and keyup also on radio/checkbox
Fixes #1062
Closes #1065
2014-05-20 15:54:26 +02:00
Markus Staab
104e8efceb Tests: Use asyncTest() method, replacing test() and stop() calls
Closes #1097
2014-04-29 17:56:41 +02:00
Nic Jansma
9dc0d1dd94 Core: Allow attributes to have a value of zero (eg min='0')
Closes #1029
Closes #930
Fixes #854
2014-03-12 11:34:02 +01: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
3d6f596485 JSHint: Replace braces with dot notation 2014-01-23 16:23:10 -05:00
Nick Schonning
91fa266cfe JSHint: Replace single for double quotes in tests 2014-01-23 16:16:53 -05:00
ruado1987
a86421131e Core: Ignore events on ignored elements
When an ignored element produces a blur event, it causes the valid() method to
return the wrong value.

Fixes gh-700
Closes gh-705
2014-01-14 17:54:51 +01:00
Andrew Ray
f93e1deb48 Core: Trigger success on optional but have other successful validators
The comment in the code itself says "when there are no other rules" but does
nothing to enforce that comment.

Fixes gh-851
Closes gh-852
2014-01-14 16:36:29 +01:00
magic.xie
c1f0baf36c Core: Fix support for multiple error classes
String#replace with a string argument replaces just once, not all matches.

Closes gh-884
2014-01-14 16:21:27 +01:00
Jörn Zaefferer
6f268031af valid(): Check all elements. Fixes #791 - valid() validates only the first (invalid) element 2013-06-24 14:59:22 +02: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
Jörn Zaefferer
93bab6e916 Make valid() return a boolean instead of 0 or 1. Fixes #109 - valid() does not return boolean value 2013-02-28 16:17:43 +01:00
Paul Cichonski
bcff73ad84 Bypass validation for buttons with 'formnovalidate' attribute (same as class="cancel"). Closes gh-623 2013-02-12 13:38:47 +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
Nick Williams
856cec06b8 Update pre-existing labels - fixes #430 closes gh-436
made assumption that any existing label which already has errorClass is
safe to update with a new message.
2013-01-31 12:55:17 +01:00
Jörn Zaefferer
b5cd04e327 Lint test files 2013-01-31 00:28:13 +01:00
Jörn Zaefferer
2b1b2563c5 Fix $.validator.format to avoid group interpolation, where at least IE8/9 replaces -bash with the match. Fixes #614 2013-01-31 00:12:32 +01:00
John-Philip Johansson
0681cc06c5 Added jQuery 1.9 to the project. Closes gh-613 2013-01-30 23:14:20 +01:00
IamDavidovich
b82d8cc1db Allow groups to be an array or a string - Fixes #479
Field names can contain spaces (as they are a CDATA type). This causes problems with groups, as the string listing the fields is split on spaces.

This commit allows the groups option to be either a space-separated string or an array of strings so that field names with spaces can be added. It also adds a unit test to ensure that both string and array based groups are processed into the same data structures.
2012-12-10 12:59:37 +01:00
Synchro
e4f3a87493 Fix some date validations, JS syntax errors. 2012-11-26 11:48:24 +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
5ec962ebb6 Update dependencies: Remove old jQuery versions, include new ones. Update QUnit and Form plugin. 2012-11-23 14:26:56 +01:00
Max Lynch
907467e874 Merged in changes for specifying custom error messages in data attributes 2012-05-15 17:39:40 -05:00
Max Lynch
a8568232a6 Add element to success call with test. Fixes #60 2012-05-07 11:30:10 +02:00
Max Lynch
f0b8042233 resetForm now clears old previousValue on form elements. Fixes #312 2012-05-04 10:48:49 -05:00
Max Lynch
aca144b5eb Disables blur event when onfocusout is set to false. Test added. 2012-04-20 15:11:34 +02:00
Max Lynch
58930870c6 Fixed value issue for radio buttons and checkboxes. Fixes #363 2012-04-20 15:09:15 +02:00
Max Lynch
a436634fe8 Added pseudo selector for text input types to fix issue with default empty type attribute. Added tests and some test markup. Fixes #217 2012-04-18 00:14:33 +02:00
Jörn Zaefferer
ba717554b1 Update to QUnit 1.5.0 2012-04-04 19:14:31 +02:00
Max Lynch
1bbf7a636f Support for dynamically added submit buttons, and updated test case. Uses validateDelegate. Code from PR #9 2012-04-02 14:55:56 +02:00
Başar Aykut
bafc78671a Fixed handling of multiple class names for errorClass option. Test by Max Lynch. Fixes #280 2012-03-29 19:20:50 +02: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
Horia Dragomir
2170712966 Fixed #189 - :hidden elements are now ignored by default 2011-09-15 14:23:10 +02:00
Jörn Zaefferer
665f67df4f Cleanup whitespace 2011-09-13 15:51:28 +02:00