class Formtastic::Inputs::HiddenInput
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).
@example Full form context, output and CSS
<%= semantic_form_for(@something) do |f| %>
<%= f.inputs do %>
<%= f.input :secret, :as => :hidden %>
<% end %>
<% end %>
<form...>
<fieldset>
<ol>
<li class="hidden">
<input type="hidden" id="something_secret" name="something[secret]">
</li>
</ol>
</fieldset>
</form>
form.formtastic li.hidden { display:none; }
@see Formtastic::Helpers::InputsHelper#input InputsHelper#input for full documentation of all possible options.
Public Instance Methods
error_html()
click to toggle source
# File lib/formtastic/inputs/hidden_input.rb, line 44 def error_html "" end
errors?()
click to toggle source
# File lib/formtastic/inputs/hidden_input.rb, line 48 def errors? false end
hint?()
click to toggle source
# File lib/formtastic/inputs/hidden_input.rb, line 56 def hint? false end
hint_html()
click to toggle source
# File lib/formtastic/inputs/hidden_input.rb, line 52 def hint_html "" end
input_html_options()
click to toggle source
Calls superclass method
# File lib/formtastic/inputs/hidden_input.rb, line 34 def input_html_options super.merge(:required => nil).merge(:autofocus => nil) end
to_html()
click to toggle source
# File lib/formtastic/inputs/hidden_input.rb, line 38 def to_html input_wrapping do builder.hidden_field(method, input_html_options) end end