Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make configurable which inputs validateForm will validate

  • Loading branch information...
commit a2e2c2ad1908ab5d0f6fc1b01de6a3dbe9992450 1 parent cec6cef
Daniel Kirsch authored
View
3  coffeescript/rails.validations.coffee
@@ -38,7 +38,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
@@ -108,6 +108,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) ->
View
3  vendor/assets/javascripts/rails.validations.js
@@ -48,7 +48,7 @@
var valid;
form.trigger('form:validate:before.ClientSideValidations');
valid = true;
- form.find(':input:enabled:visible[data-validate]').each(function() {
+ form.find(ClientSideValidations.selectors.validate_inputs).each(function() {
if (!$(this).isValid(validators)) {
valid = false;
}
@@ -128,6 +128,7 @@
window.ClientSideValidations.selectors = {
inputs: ':input:not(button):not([type="submit"])[name]:visible:enabled',
+ validate_inputs: ':input:enabled:visible[data-validate]',
forms: 'form[data-validate]'
};
Please sign in to comment.
Something went wrong with that request. Please try again.