4.1 Options Cheat Sheet - formtastic/formtastic GitHub Wiki

Formtastic Options: Cheat Sheet

semantic_form_for (Rails Options)

  • :url
  • :html

semantic_form_remote_for or semantic_remote_form_for

  • :url
  • :html
  • :update

inputs or input_field_set

  • Formtastic Fieldsetโ€™s Legend Title String
    • :name or :title
  • HTML fieldset attributes
    • Standard Attributes โ€“ :class, :dir, :id, :lang, :style, :title, :xml:lang
    • Event Attributes โ€“ :onclick, :ondblclick, :onmousedown, :onmousemove, :onmouseout, :onmouseover, :onmouseup, :onkeydown, :onkeypress, :onkeyup

input

  • :as โ€“ override the input type (eg force a :string to render as a :password field)
  • :collection โ€“ customizes the options available in the select by passing in a collection (an Array or Hash)
  • :prompt โ€“ by default, all select inputs will have a blank option at the top of the list. You can add a prompt with the :prompt option, or disable the blank option with :include_blank => false.
  • :hint โ€“ provide some text to hint or help the user provide the correct information for a field
  • :input_html โ€“ provide options that will be passed down to the generated input
  • :label โ€“ use something other than the method name as the label text, when false no label is printed
  • :member_label allows you to customize the text label inside each option tag two ways:
    • by naming the correct method to call on each object in the collection as a symbol (:name, :login, etc)
    • by passing a Proc that will be called on each object in the collection, allowing you to use helpers or multiple model attributes together
  • :member_value โ€“ provides the same customization of the value attribute of each option tag
  • :required โ€“ specify if the column is required (true) or not (false)
  • :wrapper_html โ€“ provide options that will be passed down to the li wrapper
  • :checked_value and :unchecked_value โ€“ change the checked and unchecked values for boolean fields

buttons or button_field_set

  • :button_html โ€“ provide options that will be passed down to the generated button

See inputs options for html attributes and special options

โš ๏ธ **GitHub.com Fallback** โš ๏ธ