Class: Formtastic::Inputs::HiddenInput
- Inherits:
-
Object
- Object
- Formtastic::Inputs::HiddenInput
- Includes:
- Base
- Defined in:
- lib/formtastic/inputs/hidden_input.rb
Overview
Outputs a simple ‘<input type=“hidden”>` wrapped in the standard `<li>` wrapper. This is provided for situations where a hidden field needs to be rendered in the flow of a form with many inputs that form an `<ol>`. Wrapping the hidden input inside the `<li>` maintains the HTML validity. The `<li>` is marked with a `class` of `hidden` so that stylesheet authors can hide these list items with CSS (formtastic.css does this out of the box).
Instance Attribute Summary
Attributes included from Base
#builder, #method, #object, #object_name, #options, #template
Instance Method Summary collapse
- #error_html ⇒ Object
- #errors? ⇒ Boolean
- #hint? ⇒ Boolean
- #hint_html ⇒ Object
-
#input_html_options ⇒ Object
Override to include :value set directly from options hash.
- #to_html ⇒ Object
Methods included from Base
Methods included from Base::Wrapping
#input_wrapping, #wrapper_dom_id, #wrapper_html_options
Methods included from Base::Labelling
#label_from_options, #label_html, #label_html_options, #label_text, #localized_label, #render_label?, #requirement_text, #requirement_text_or_proc
Methods included from Base::Associations
#association, #association_primary_key, #belongs_to?, #reflection
Methods included from Base::Fileish
Methods included from Base::Validations
#column_limit, #limit, #not_required_through_negated_validation!, #not_required_through_negated_validation?, #optional?, #required?, #validation_integer_only?, #validation_limit, #validation_max, #validation_min, #validations, #validations?, #validator_relevant?
Methods included from Base::Naming
#as, #attributized_method_name, #humanized_method_name, #input_name, #sanitized_method_name, #sanitized_object_name
Methods included from Base::Hints
#hint_text, #hint_text_from_options
Methods included from Base::Errors
#error_first_html, #error_keys, #error_list_html, #error_none_html, #error_sentence_html, #errors
Methods included from Base::Database
Methods included from Base::Options
#formtastic_options, #input_options
Methods included from Base::Html
Instance Method Details
#error_html ⇒ Object
48 49 50 |
# File 'lib/formtastic/inputs/hidden_input.rb', line 48 def error_html "" end |
#errors? ⇒ Boolean
52 53 54 |
# File 'lib/formtastic/inputs/hidden_input.rb', line 52 def errors? false end |
#hint? ⇒ Boolean
60 61 62 |
# File 'lib/formtastic/inputs/hidden_input.rb', line 60 def hint? false end |
#hint_html ⇒ Object
56 57 58 |
# File 'lib/formtastic/inputs/hidden_input.rb', line 56 def hint_html "" end |
#input_html_options ⇒ Object
this is inconsistent with all other inputs, deprecate and remove
Override to include :value set directly from options hash. The :value set in :input_html hash will be preferred over :value set directly in the options.
38 39 40 |
# File 'lib/formtastic/inputs/hidden_input.rb', line 38 def {:value => [:value]}.merge(super).merge(:required => nil) end |
#to_html ⇒ Object
42 43 44 45 46 |
# File 'lib/formtastic/inputs/hidden_input.rb', line 42 def to_html input_wrapping do builder.hidden_field(method, ) end end |