Created
April 6, 2011 15:05
-
-
Save bcardarella/905804 to your computer and use it in GitHub Desktop.
custom formbuilders for client side validations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// rails.validations.custom.formbuilder.js | |
// Assuming that your custom Formtastic FormBuilder class is called 'MyCustomFormBuilderClass' | |
clientSideValidations.formBuilders['MyCustomFormBuilderClass'] = { | |
add: function(element, settings, message) { | |
clientSideValidations.formBuilders['Formtastic::SemanticFormBuilder'].add(element, settings, message); | |
}, | |
remove: function(element, settings, message) { | |
clientSideValidations.formBuilders['Formtastic::SemanticFormBuilder'].remove(element, settings, message); | |
} | |
} |
Updated :)
missed one :-)
in case anyone else winds up here, note that you'll need to change clientSideValidations
to ClientSideValidations
(uppercase). Other than that still seems to work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After wondering why it did not work for a while, I did a s/formbuilders/formBuilders/ and was illuminated :-)