Skip to content

Commit 92e7958

Browse files
committed
version 2.1.8, more info in release notes
1 parent 57f7671 commit 92e7958

13 files changed

+47
-24
lines changed

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ particular form.
3232
<script src="js/form-validator/jquery.form-validator.min.js"></script>
3333
<script>
3434
/* important to locate this script AFTER the closing form element, so form object is loaded in DOM before setup is called */
35-
$.validationSetup({
35+
$.validate({
3636
modules : 'date, security'
3737
});
3838
</script>
@@ -48,7 +48,7 @@ So what has changed since version 1.x?
4848
* You no longer need to prefix the validation rules with "validate_".
4949
* Error message position now defaults to "element".
5050
* The optional features (validateOnBlur and showHelpOnFocus) is now enabled by default.
51-
* The function $.validationSetup(config) is introduced to reduce the amount of code that has to be written when initiating the form validation.
51+
* The function $.validate(config) is introduced to reduce the amount of code that has to be written when initiating the form validation.
5252
* Demos and full documentation is now available at http://formvalidator.net/
5353

5454
### Default validators and features (no module needed)
@@ -144,7 +144,7 @@ that checks if the input contains an even number.
144144
});
145145
146146
// Initiate form validation
147-
$.validationSetup();
147+
$.validate();
148148
149149
</script>
150150
```
@@ -262,7 +262,7 @@ var enErrorDialogs = {
262262
<script src="js/form-validator/jquery.form-validator.min.js"></script>
263263
<script src="js/form-validator/locale.en.js"></script>
264264
<script>
265-
$.validationSetup({
265+
$.validate({
266266
language : enErrorDialogs
267267
});
268268
</script>
@@ -294,6 +294,13 @@ it calls jQ func **$.formUtils.validateInput** to validate the single input when
294294

295295
## Changelog
296296

297+
#### 2.1.8
298+
* Now possible to configure the decimal separator when validating float values. Use either the
299+
attribute *data-validation-decimal-separator* or the property *decimalSeparator* when
300+
calling $.validate()
301+
* $.validationSetup is renamed to $.validate. You will still be able to initiate the validation by calling
302+
the $.validationSetup but it's considered deprecated.
303+
297304
#### 2.1.6
298305
* Modules can now be loaded from remote website
299306

form-validator/.DS_Store

6 KB
Binary file not shown.

form-validator/date.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/#location-validators
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.6
13+
* @version 2.1.8
1414
*/
1515
(function($) {
1616

form-validator/file.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.6
13+
* @version 2.1.8
1414
*/
1515
(function($, window) {
1616

form-validator/form-test.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141

142142
var dev = window.location.hash.indexOf('dev') > -1 ? '.dev' : '';
143143

144-
$.validationSetup({
144+
$.validate({
145145
language : {
146146
requiredFields: 'Du måste bocka för denna'
147147
},
@@ -173,7 +173,7 @@
173173
}
174174
});
175175

176-
// Load one module outside $.validationSetup() even though you do not have to
176+
// Load one module outside $.validate() even though you do not have to
177177
$.formUtils.loadModules('date'+dev+'.js', false, false);
178178

179179
// Add a new validator

form-validator/jquery.form-validator.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* @website http://formvalidator.net/
77
* @license Dual licensed under the MIT or GPL Version 2 licenses
8-
* @version 2.1.6
8+
* @version 2.1.8
99
*/
1010
(function($) {
1111

@@ -401,7 +401,7 @@
401401
* Short hand function that makes the validation setup require less code
402402
* @param config
403403
*/
404-
$.validationSetup = function(config) {
404+
$.validate = function(config) {
405405
config = $.extend({
406406
form : 'form',
407407
validateOnBlur : true,
@@ -459,6 +459,17 @@
459459
}
460460
};
461461

462+
/**
463+
* @deprecated
464+
* @param {Object} config
465+
*/
466+
$.validationSetup = function(config) {
467+
if( typeof console != 'undefined' && console.warn ) {
468+
window.console.warn('Using deprecated function $.validationSetup, pls use $.validate instead');
469+
}
470+
$.validate(config);
471+
};
472+
462473
/**
463474
* Object containing utility methods for this plugin
464475
*/
@@ -477,7 +488,8 @@
477488
validationErrorMsgAttribute : 'data-validation-error-msg', // define custom err msg inline with element
478489
errorMessagePosition : 'element', // Can be either "top" or "element"
479490
scrollToTopOnError : true,
480-
dateFormat : 'yyyy-mm-dd'
491+
dateFormat : 'yyyy-mm-dd',
492+
decimalSeparator : '.'
481493
}
482494
},
483495

@@ -1303,9 +1315,11 @@
13031315
*/
13041316
$.formUtils.addValidator({
13051317
name : 'number',
1306-
validatorFunction : function(val, $el) {
1318+
validatorFunction : function(val, $el, config) {
13071319
if(val !== '') {
1308-
var allowing = $el.valAttr('allowing') || '';
1320+
var allowing = $el.valAttr('allowing') || '',
1321+
decimalSeparator = $el.valAttr('decimal-separator') || config.decimalSeparator;
1322+
13091323
if(allowing.indexOf('number') == -1)
13101324
allowing += ',number';
13111325

@@ -1316,7 +1330,7 @@
13161330
if(allowing.indexOf('number') > -1 && val.replace(/[0-9]/g, '') === '') {
13171331
return true;
13181332
}
1319-
if(allowing.indexOf('float') > -1 && val.match(/^([0-9]+)\.([0-9]+)$/) !== null) {
1333+
if(allowing.indexOf('float') > -1 && val.match(new RegExp('^([0-9]+)\\'+decimalSeparator+'([0-9]+)$')) !== null) {
13201334
return true;
13211335
}
13221336
}

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
@@ -10,7 +10,7 @@
1010
*
1111
* @website http://formvalidator.net/#location-validators
1212
* @license Dual licensed under the MIT or GPL Version 2 licenses
13-
* @version 2.1.6
13+
* @version 2.1.8
1414
*/
1515
(function($) {
1616

form-validator/qunit.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,10 @@
198198
{val:input('1.023', {'allowing':'float', '':'number'}), isValid:true},
199199
{val:'-1.032', isValid:false},
200200
{val:input('-1.023', {'allowing':'float,negative', '':'number'}), isValid:true},
201-
{val:input('1.023', {'allowing':'float,negative', '':'number'}), isValid:true},
202-
{val:input('1.023', {'allowing':'float,negative,number', '':'number'}), isValid:true},
201+
{val:input('1.0234', {'allowing':'float,negative', '':'number'}), isValid:true},
202+
{val:input('1.0235', {'allowing':'float,negative,number', '':'number'}), isValid:true},
203+
{val:input('1.0236', {'allowing':'float,negative,number', 'decimal-separator':',', '':'number'}), isValid:false},
204+
//{val:input('1,023', {'allowing':'float,negative,number', 'decimal-separator':',', '':'number'}), isValid:true},
203205
{val:'123', isValid:true}
204206
];
205207

@@ -438,7 +440,7 @@
438440

439441
var dev = window.location.hash.indexOf('dev') > -1 ? '.dev' : '';
440442

441-
$.validationSetup({
443+
$.validate({
442444
modules : 'security'+dev+', location'+dev+', sweden'+dev+', file'+dev+', date'+dev+', uk'+dev,
443445
onModulesLoaded: function( $form ) {
444446
console.log('About to run all tests');

form-validator/security.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* @website http://formvalidator.net/#security-validators
1414
* @license Dual licensed under the MIT or GPL Version 2 licenses
15-
* @version 2.1.6
15+
* @version 2.1.8
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
*
1414
* @website http://formvalidator.net/#swedish-validators
1515
* @license Dual licensed under the MIT or GPL Version 2 licenses
16-
* @version 2.1.6
16+
* @version 2.1.8
1717
*/
1818
(function($, window) {
1919

form-validator/uk.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* @website http://formvalidator.net/#uk-validators
1111
* @license Dual licensed under the MIT or GPL Version 2 licenses
12-
* @version 2.1.6
12+
* @version 2.1.8
1313
*/
1414
$.formUtils.addValidator({
1515
name : 'ukvatnumber',

formvalidator.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"validation",
88
"validator"
99
],
10-
"version" : "2.1.6",
10+
"version" : "2.1.8",
1111
"author" : {
1212
"name": "Victor Jonsson",
1313
"url": "http://victorjonsson.se",

0 commit comments

Comments
 (0)