-
Notifications
You must be signed in to change notification settings - Fork 629
4.1 Options Cheat Sheet
Grant Birchmeier edited this page Jan 3, 2017
·
40 revisions
:url
:html
:url
:html
:update
-
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
- Standard Attributes –
-
: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
-
:button_html
– provide options that will be passed down to the generated button
See inputs options for html attributes and special options