Skip to content

Using different wrappers

ilyakatz edited this page Aug 29, 2012 · 1 revision

If you create a custom wrapper for your simple form

<%= simple_form_for @topic, wrapper: :label_hint do %>

You will need to make sure that ClientSideValidations formbuilder has a way to handle addition/removal of errors. Simple way would be to reuse a default wrapper if applicable

#= require rails.validations
#= require rails.validations.simple_form

(->
  ClientSideValidations.formBuilders['SimpleForm::FormBuilder']['wrappers']["label_hint"] =
    ClientSideValidations.formBuilders['SimpleForm::FormBuilder']['wrappers']["default"]
).call(this)

Else, you will need to write your own (see https://github.com/dockyard/client_side_validations-simple_form/blob/master/coffeescript/rails.validations.simple_form.coffee)

Clone this wiki locally