Module: Formtastic::Helpers::InputHelper

Included in:
Defined in:


#input is used to render all content (labels, form widgets, error messages, hints, etc) for a single form input (or field), usually representing a single method or attribute on the form's object or model.

The content is wrapped in an <li> tag, so it's usually called inside an inputs block (which renders an <ol> inside a <fieldset>), which should be inside a semantic_form_for block:

<%= semantic_form_for @post do |f| %>
  <%= f.inputs do %>
    <%= f.input :title %>
    <%= f.input :body %>
  <% end %>
<% end %>

The HTML output will be something like:

<form class="formtastic" method="post" action="...">
      <li class="string required" id="post_title_input">
      <li class="text required" id="post_body_input">