Skip to content

Commit 24075ee

Browse files
committed
validation no longer requires that inputs have names
1 parent 539ced5 commit 24075ee

File tree

10 files changed

+25
-25
lines changed

10 files changed

+25
-25
lines changed

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.2.beta.29
13+
* @version 2.2.beta.30
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.2.beta.29
13+
* @version 2.2.beta.30
1414
*/
1515
(function($, window) {
1616

form-validator/html5.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @website http://formvalidator.net/
1919
* @license Dual licensed under the MIT or GPL Version 2 licenses
20-
* @version 2.2.beta.29
20+
* @version 2.2.beta.30
2121
*/
2222
(function($, window) {
2323

form-validator/jquery.form-validator.js

Lines changed: 12 additions & 13 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.2.beta.29
8+
* @version 2.2.beta.30
99
*/
1010
(function($) {
1111

@@ -326,19 +326,16 @@
326326
* @para {jQuery} $elem
327327
*/
328328
var addErrorMessage = function(mess, $elem) {
329-
// validate server side will return null as error message before the server is requested
330-
if(mess !== null) {
331-
if ($.inArray(mess, errorMessages) < 0) {
332-
errorMessages.push(mess);
333-
}
334-
errorInputs.push($elem);
335-
$elem.attr('current-error', mess);
336-
if( displayError )
337-
_applyErrorStyle($elem, conf);
329+
if ($.inArray(mess, errorMessages) < 0) {
330+
errorMessages.push(mess);
338331
}
332+
errorInputs.push($elem);
333+
$elem.attr('current-error', mess);
334+
if( displayError )
335+
_applyErrorStyle($elem, conf);
339336
},
340337

341-
/** HoldsInputs already validated, to prevent recheck of mulitple checkboxes & radios */
338+
/** Holds inputs (of type checkox or radio) already validated, to prevent recheck of mulitple checkboxes & radios */
342339
checkedInputs = [],
343340

344341
/** Error messages for this validation */
@@ -374,11 +371,13 @@
374371
$form.find('input,textarea,select').filter(':not([type="submit"],[type="button"])').each(function() {
375372
var $elem = $(this),
376373
elementType = $elem.attr('type'),
374+
isCheckboxOrRadioBtn = elementType == 'radio' || elementType == 'checkbox',
377375
elementName = $elem.attr('name');
378376

379-
if (!ignoreInput(elementName, elementType) && $.inArray(elementName, checkedInputs) < 0 ) {
377+
if (!ignoreInput(elementName, elementType) && (!isCheckboxOrRadioBtn || $.inArray(elementName, checkedInputs) < 0) ) {
380378

381-
checkedInputs.push(elementName);
379+
if( isCheckboxOrRadioBtn )
380+
checkedInputs.push(elementName);
382381

383382
var validation = $.formUtils.validateInput(
384383
$elem,

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

Lines changed: 3 additions & 3 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.2.beta.29
13+
* @version 2.2.beta.30
1414
*/
1515
(function($) {
1616

form-validator/qunit.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252

5353
var message;
5454
if( typeof obj.val == 'string' ) {
55-
message = 'Check that '+obj.val+' is '+(obj.isValid ? 'valid':'invalid');
55+
message = 'Check that "'+obj.val+'" is '+(obj.isValid ? 'valid':'invalid');
5656
} else {
57-
message = 'Check that input[value='+obj.val.attr('value')+'] is '+(obj.isValid ? 'valid':'invalid');
57+
message = 'Check that input[value="'+obj.val.attr('value')+'"] is '+(obj.isValid ? 'valid':'invalid');
5858
}
5959

6060
if( result === null && obj.isValid ) {
@@ -215,6 +215,7 @@
215215
{val:'a,bbb', isValid:false},
216216
{val:input('a,bbb', {'allowing':',', '':'alphanumeric'}), isValid:true},
217217
{val:input('a b', {'allowing':' ', '':'alphanumeric'}), isValid:true},
218+
{val:input('', {'allowing':' ', length:'3-12', '':'length alphanumeric'}), isValid:false},
218219
{val:input('a-_ bäöåÖA', {'allowing':' -_öäåÄÖÅ', '':'alphanumeric'}), isValid:true}
219220
];
220221

form-validator/security.dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* - cvv
1414
*
1515
* @website http://formvalidator.net/#security-validators
16-
* @version 2.2.beta.29
16+
* @version 2.2.beta.30
1717
*/
1818
(function($, window) {
1919

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.2.beta.29
16+
* @version 2.2.beta.30
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.2.beta.29
12+
* @version 2.2.beta.30
1313
*/
1414
$.formUtils.addValidator({
1515
name : 'ukvatnumber',

0 commit comments

Comments
 (0)