Skip to content

Commit

Permalink
Merge pull request #47 from bboyle/refactor-name
Browse files Browse the repository at this point in the history
refactor conditional logic for duplicate name #40
  • Loading branch information
bboyle committed Apr 8, 2014
2 parents cc95b51 + 21674e4 commit 8c467fb
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "form-validation",
"version": "1.1.0",
"version": "1.1.1",
"homepage": "https://github.com/bboyle/form-validation",
"authors": [
"Ben Boyle <[email protected]>"
Expand Down
11 changes: 6 additions & 5 deletions dist/form-validation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Form validation - v1.1.0 - 2014-04-09
/*! Form validation - v1.1.1 - 2014-04-09
* https://github.com/bboyle/form-validation
* Copyright (c) 2014 Ben Boyle; Licensed MIT */
(function( $ ) {
Expand Down Expand Up @@ -143,11 +143,12 @@
return false;
}

if ( ! invalidFields.cache ) {
invalidFields.cache = {};
// only check radio button groups once (skip individual radio button)
if ( this.type === 'radio' ) {
if ( ! invalidFields.cache ) {
invalidFields.cache = {};

} else if ( this.type === 'radio' ) {
if ( invalidFields.cache[ this.name ] === true ) {
} else if ( invalidFields.cache[ this.name ] === true ) {
return false;
}
invalidFields.cache[ this.name ] = true;
Expand Down
4 changes: 2 additions & 2 deletions dist/form-validation.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "form-validation",
"title": "Form validation",
"description": "Validation UI for web forms using the HTML5 constraint validation API",
"version": "1.1.0",
"version": "1.1.1",
"homepage": "https://github.com/bboyle/form-validation",
"author": {
"name": "Ben Boyle",
Expand Down
9 changes: 5 additions & 4 deletions src/form-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@
return false;
}

if ( ! invalidFields.cache ) {
invalidFields.cache = {};
// only check radio button groups once (skip individual radio button)
if ( this.type === 'radio' ) {
if ( ! invalidFields.cache ) {
invalidFields.cache = {};

} else if ( this.type === 'radio' ) {
if ( invalidFields.cache[ this.name ] === true ) {
} else if ( invalidFields.cache[ this.name ] === true ) {
return false;
}
invalidFields.cache[ this.name ] = true;
Expand Down

0 comments on commit 8c467fb

Please sign in to comment.