Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
custom formbuilders for client side validations
// 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);
}
}
@mat813

This comment has been minimized.

Show comment Hide comment
@mat813

mat813 Apr 8, 2011

After wondering why it did not work for a while, I did a s/formbuilders/formBuilders/ and was illuminated :-)

mat813 commented Apr 8, 2011

After wondering why it did not work for a while, I did a s/formbuilders/formBuilders/ and was illuminated :-)

@bcardarella

This comment has been minimized.

Show comment Hide comment
@bcardarella

bcardarella Apr 8, 2011

Updated :)

Owner

bcardarella commented Apr 8, 2011

Updated :)

@mat813

This comment has been minimized.

Show comment Hide comment
@mat813

mat813 Apr 8, 2011

missed one :-)

mat813 commented Apr 8, 2011

missed one :-)

@hmayer00

This comment has been minimized.

Show comment Hide comment
@hmayer00

hmayer00 Oct 18, 2013

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.

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