Module: Formtastic

Extended by:
ActiveSupport::Autoload
Defined in:
lib/formtastic/util.rb,
lib/formtastic.rb,
lib/formtastic/i18n.rb,
lib/formtastic/engine.rb,
lib/formtastic/inputs.rb,
lib/formtastic/actions.rb,
lib/formtastic/helpers.rb,
lib/formtastic/version.rb,
lib/formtastic/localizer.rb,
lib/formtastic/inputs/base.rb,
lib/formtastic/actions/base.rb,
lib/formtastic/form_builder.rb,
lib/formtastic/html_attributes.rb,
lib/formtastic/inputs/base/html.rb,
lib/formtastic/inputs/url_input.rb,
lib/formtastic/localized_string.rb,
lib/formtastic/actions/buttonish.rb,
lib/formtastic/inputs/base/hints.rb,
lib/formtastic/inputs/date_input.rb,
lib/formtastic/inputs/file_input.rb,
lib/formtastic/inputs/text_input.rb,
lib/formtastic/inputs/time_input.rb,
lib/formtastic/helpers/reflection.rb,
lib/formtastic/inputs/base/errors.rb,
lib/formtastic/inputs/base/naming.rb,
lib/formtastic/inputs/email_input.rb,
lib/formtastic/inputs/phone_input.rb,
lib/formtastic/inputs/radio_input.rb,
lib/formtastic/inputs/range_input.rb,
lib/formtastic/actions/link_action.rb,
lib/formtastic/helpers/form_helper.rb,
lib/formtastic/inputs/base/choices.rb,
lib/formtastic/inputs/base/fileish.rb,
lib/formtastic/inputs/base/numeric.rb,
lib/formtastic/inputs/base/options.rb,
lib/formtastic/inputs/base/timeish.rb,
lib/formtastic/inputs/hidden_input.rb,
lib/formtastic/inputs/number_input.rb,
lib/formtastic/inputs/search_input.rb,
lib/formtastic/inputs/select_input.rb,
lib/formtastic/inputs/string_input.rb,
lib/formtastic/actions/input_action.rb,
lib/formtastic/helpers/input_helper.rb,
lib/formtastic/inputs/base/database.rb,
lib/formtastic/inputs/base/wrapping.rb,
lib/formtastic/inputs/boolean_input.rb,
lib/formtastic/inputs/country_input.rb,
lib/formtastic/actions/button_action.rb,
lib/formtastic/helpers/action_helper.rb,
lib/formtastic/helpers/errors_helper.rb,
lib/formtastic/helpers/inputs_helper.rb,
lib/formtastic/inputs/base/labelling.rb,
lib/formtastic/inputs/base/stringish.rb,
lib/formtastic/inputs/datetime_input.rb,
lib/formtastic/inputs/password_input.rb,
lib/formtastic/helpers/actions_helper.rb,
lib/formtastic/helpers/buttons_helper.rb,
lib/formtastic/inputs/time_zone_input.rb,
lib/formtastic/inputs/base/collections.rb,
lib/formtastic/inputs/base/placeholder.rb,
lib/formtastic/inputs/base/validations.rb,
lib/formtastic/helpers/fieldset_wrapper.rb,
lib/formtastic/inputs/base/associations.rb,
lib/formtastic/inputs/check_boxes_input.rb,
lib/formtastic/helpers/file_column_detection.rb,
lib/generators/formtastic/form/form_generator.rb,
lib/formtastic/inputs/base/grouped_collections.rb,
lib/generators/formtastic/install/install_generator.rb

Overview

TODO:

document i18n keys

TODO:

document i18n translation with :label (?)

Outputs a <button type="submit"> or <button type="reset"> wrapped in the standard <li> wrapper. This is an alternative choice for :submit and :reset actions, which render with <input type="submit"> and <input type="reset"> by default.

Examples:

Full form context and output


<%= semantic_form_for(@post) do |f| %>
  <%= f.actions do %>
    <%= f.action :reset, :as => :button %>
    <%= f.action :submit, :as => :button %>
  <% end %>
<% end %>

<form...>
  <fieldset class="actions">
    <ol>
      <li class="action button_action" id="post_reset_action">
        <button type="reset" value="Reset">
      </li>
      <li class="action button_action" id="post_submit_action">
        <button type="submit" value="Create Post">
      </li>
    </ol>
  </fieldset>
</form>

Specifying a label with a String

<%= f.action :submit, :as => :button, :label => "Go" %>

Pass HTML attributes down to the <button>

<%= f.action :submit, :as => :button, :button_html => { :class => 'pretty', :accesskey => 'g', :disable_with => "Wait..." } %>

Access key can also be set as a top-level option

<%= f.action :submit, :as => :button, :accesskey => 'g' %>

Pass HTML attributes down to the <li> wrapper (classes are appended to the existing classes)

<%= f.action :submit, :as => :button, :wrapper_html => { :class => 'special', :id => 'whatever' } %>
<%= f.action :submit, :as => :button, :wrapper_html => { :class => ['extra', 'special'], :id => 'whatever' } %>

Defined Under Namespace

Modules: Actions, Inputs, LocalizedString Classes: FormBuilder, FormGenerator, InstallGenerator, Localizer

Constant Summary collapse

VERSION =
"2.1.0"