Skip to content

Commit bab98e9

Browse files
committed
added qunit tests, suggestions now supports partial matching
1 parent 422c12f commit bab98e9

File tree

10 files changed

+251
-184
lines changed

10 files changed

+251
-184
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ So what has changed since version 1.x?
5555
* **date***yyyy-mm-dd (format can be customized, more information below)*
5656
* **length***min/max/range*
5757
* **required***no validation except that a value has to be given*
58-
* **custom***Validate value against regexp
58+
* **custom***Validate value against regexp*
5959
* **num_answers***Validate that a select element has the required number of selected options (num_answers num5)*
6060
* Show help information automatically when input is focused
6161
* Validate given values immediately when input looses focus.

form-validator/date.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* @license Dual licensed under the MIT or GPL Version 2 licenses
15-
* @version 1.9.19
15+
* @version 1.9.20
1616
*/
1717
(function($) {
1818

form-validator/index.html

Lines changed: 0 additions & 170 deletions
This file was deleted.

form-validator/jquery.form-validator.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Documentation and issue tracking on Github <https://github.com/victorjonsson/jQuery-Form-Validator/>
66
*
77
* @license Dual licensed under the MIT or GPL Version 2 licenses
8-
* @version 1.9.19
8+
* @version 1.9.20
99
*/
1010
(function($) {
1111

@@ -470,6 +470,7 @@
470470
* @param {Function} callback
471471
*/
472472
on : function(evt, callback) {
473+
// Why not use $(document).bind('validators.loaded', func);
473474
this._events[evt].push(callback);
474475
},
475476

@@ -852,8 +853,10 @@
852853

853854
// Find the right suggestions
854855
if(val != '') {
856+
var findPartials = val.length > 2 ? true:false;
855857
$.each(suggestions, function(i, v) {
856-
if(v.toLocaleLowerCase().indexOf(val) === 0) {
858+
v = v.toLocaleLowerCase();
859+
if(v.indexOf(val) === 0 || (findPartials && v.indexOf(val) > -1)) {
857860
foundSuggestions.push(v);
858861
}
859862
});
@@ -1210,12 +1213,13 @@
12101213
name : 'validate_number',
12111214
validate : function(val, $el) {
12121215
if(val !== '') {
1213-
var allowing = $el.valAttr('allowing');
1214-
if(allowing === undefined)
1215-
allowing = 'number';
1216+
var allowing = $el.valAttr('allowing') || '';
1217+
if(allowing.indexOf('number') == -1)
1218+
allowing += ',number';
12161219

1217-
if(allowing.indexOf('negative') > -1 && val.indexOf('-') === 0)
1220+
if(allowing.indexOf('negative') > -1 && val.indexOf('-') === 0) {
12181221
val = val.substr(1);
1222+
}
12191223

12201224
if(allowing.indexOf('number') > -1 && val.replace(/[0-9]/g, '') === '') {
12211225
return true;

form-validator/jquery.form-validator.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

form-validator/location.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* @license Dual licensed under the MIT or GPL Version 2 licenses
14-
* @version 1.9.19
14+
* @version 1.9.20
1515
*/
1616
(function($) {
1717

form-validator/security.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* - validate_backend
1313
*
1414
* @license Dual licensed under the MIT or GPL Version 2 licenses
15-
* @version 1.9.19
15+
* @version 1.9.20
1616
*/
1717
(function($) {
1818

form-validator/sweden.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - validate_swephone
1414
*
1515
* @license Dual licensed under the MIT or GPL Version 2 licenses
16-
* @version 1.9.19
16+
* @version 1.9.20
1717
*/
1818
(function($) {
1919

0 commit comments

Comments
 (0)