Skip to content

Commit

Permalink
Merge pull request DavyJonesLocker#454 from kirel/v3.2.1-configurable…
Browse files Browse the repository at this point in the history
…-validatable-inputs

Make configurable which inputs validateForm will validate
  • Loading branch information
bcardarella committed Jan 3, 2013
2 parents 12ab764 + a2e2c2a commit 1f07ef0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion coffeescript/rails.validations.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ validateForm = (form, validators) ->
form.trigger('form:validate:before.ClientSideValidations')

valid = true
form.find(':input:enabled:visible[data-validate]').each ->
form.find(ClientSideValidations.selectors.validate_inputs).each ->
valid = false unless $(@).isValid(validators)
# we don't want the loop to break out by mistake
true
Expand Down Expand Up @@ -107,6 +107,7 @@ if window.ClientSideValidations.forms == undefined

window.ClientSideValidations.selectors =
inputs: ':input:not(button):not([type="submit"])[name]:visible:enabled'
validate_inputs: ':input:enabled:visible[data-validate]'
forms: 'form[data-validate]'

window.ClientSideValidations.reset = (form) ->
Expand Down
3 changes: 2 additions & 1 deletion vendor/assets/javascripts/rails.validations.js

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

0 comments on commit 1f07ef0

Please sign in to comment.