Skip to content

Commit e7e5c5d

Browse files
author
Tom Hanoldt
committed
fix validating checkboxes
1 parent 5efb4f6 commit e7e5c5d

File tree

7 files changed

+19
-12
lines changed

7 files changed

+19
-12
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery.input.validator",
3-
"version": "1.0.19",
3+
"version": "1.0.20",
44
"homepage": "https://github.com/creative-workflow/jquery.input.validator",
55
"authors": [
66
"Tom Hanoldt <[email protected]>"

dist/jquery.input.validator.js

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

dist/jquery.input.validator.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.input.validator.min.js

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

docs/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Changelog
22

3+
##### 1.0.20
4+
* fix validating checkboxes
5+
36
##### 1.0.19
47
* better email regexp
5-
8+
69
##### 1.0.17
710
* add `scrollToOnInvalid` and `scrollToOnInvalidOffset` for circumvent ios focus restrictions
811

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery.input.validator",
3-
"version": "1.0.19",
3+
"version": "1.0.20",
44
"description": "This jquery plugin helps to handle html input validation. It uses strict html attributes to map the validation rules and is easy extendable.",
55
"main": "dist/jquery.input.validator.js",
66
"repository": {

src/input.validator.coffee

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,12 @@ class @InputValidator
181181
return errors
182182

183183
validateOne: (element) =>
184-
$element = $(element)
185-
value = $element.val()
186184
errors = []
185+
$element = $(element)
186+
if $element.attr('type') == 'checkbox'
187+
value = if $element.is(":checked") then $element.val() else null
188+
else
189+
value = $element.val()
187190

188191
for name, rule of @config.rules
189192
unless rule(@, $element, value)

0 commit comments

Comments
 (0)