Module SimpleForm
In: lib/simple_form.rb
lib/generators/simple_form/install_generator.rb
lib/simple_form/tags.rb
lib/simple_form/components.rb
lib/simple_form/components/hints.rb
lib/simple_form/components/html5.rb
lib/simple_form/components/maxlength.rb
lib/simple_form/components/label_input.rb
lib/simple_form/components/labels.rb
lib/simple_form/components/pattern.rb
lib/simple_form/components/readonly.rb
lib/simple_form/components/placeholders.rb
lib/simple_form/components/errors.rb
lib/simple_form/components/min_max.rb
lib/simple_form/components/minlength.rb
lib/simple_form/wrappers/root.rb
lib/simple_form/wrappers/single.rb
lib/simple_form/wrappers/many.rb
lib/simple_form/wrappers/leaf.rb
lib/simple_form/wrappers/builder.rb
lib/simple_form/form_builder.rb
lib/simple_form/version.rb
lib/simple_form/map_type.rb
lib/simple_form/railtie.rb
lib/simple_form/helpers/validators.rb
lib/simple_form/helpers/required.rb
lib/simple_form/helpers/readonly.rb
lib/simple_form/helpers/autofocus.rb
lib/simple_form/helpers/disabled.rb
lib/simple_form/action_view_extensions/builder.rb
lib/simple_form/action_view_extensions/form_helper.rb
lib/simple_form/i18n_cache.rb
lib/simple_form/wrappers.rb
lib/simple_form/inputs/password_input.rb
lib/simple_form/inputs/date_time_input.rb
lib/simple_form/inputs/base.rb
lib/simple_form/inputs/color_input.rb
lib/simple_form/inputs/block_input.rb
lib/simple_form/inputs/file_input.rb
lib/simple_form/inputs/string_input.rb
lib/simple_form/inputs/boolean_input.rb
lib/simple_form/inputs/hidden_input.rb
lib/simple_form/inputs/collection_radio_buttons_input.rb
lib/simple_form/inputs/collection_check_boxes_input.rb
lib/simple_form/inputs/priority_input.rb
lib/simple_form/inputs/text_input.rb
lib/simple_form/inputs/numeric_input.rb
lib/simple_form/inputs/collection_input.rb
lib/simple_form/inputs/collection_select_input.rb
lib/simple_form/inputs/range_input.rb
lib/simple_form/inputs/grouped_collection_select_input.rb
lib/simple_form/error_notification.rb
lib/simple_form/inputs.rb
lib/simple_form/helpers.rb

frozen_string_literal: true

Methods

Classes and Modules

Module SimpleForm::ActionViewExtensions
Module SimpleForm::Components
Module SimpleForm::Generators
Module SimpleForm::Helpers
Module SimpleForm::I18nCache
Module SimpleForm::Inputs
Module SimpleForm::MapType
Module SimpleForm::Tags
Module SimpleForm::Wrappers
Class SimpleForm::ErrorNotification
Class SimpleForm::FormBuilder
Class SimpleForm::Railtie
Class SimpleForm::WrapperNotFound

Constants

CUSTOM_INPUT_DEPRECATION_WARN = <<-WARN %{name} method now accepts a `wrapper_options` argument. The method definition without the argument is deprecated and will be removed in the next Simple Form version. Change your code from: def %{name} to def %{name}(wrapper_options) See https://github.com/plataformatec/simple_form/pull/997 for more information. WARN
VERSION = "4.1.0".freeze

Public Class methods

Includes a component to be used by Simple Form. Methods defined in a component will be exposed to be used in the wrapper as Simple::Components

Examples

   # The application needs to tell where the components will be.
   Dir[Rails.root.join('lib/components/**/*.rb')].each { |f| require f }

   # Create a custom component in the path specified above.
   # lib/components/input_group_component.rb
   module InputGroupComponent
     def prepend
       ...
     end

     def append
       ...
     end
   end

   SimpleForm.setup do |config|
     # Create a wrapper using the custom component.
     config.wrappers :input_group, tag: :div, error_class: :error do |b|
       b.use :label
       b.optional :prepend
       b.use :input
       b.use :append
     end
   end

   # Using the custom component in the form.
   <%= simple_form_for @blog, wrapper: input_group do |f| %>
     <%= f.input :title, prepend: true %>
   <% end %>

Default way to setup Simple Form. Run rails generate simple_form:install to create a fresh initializer with all configuration values.

Retrieves a given wrapper

Define a new wrapper using SimpleForm::Wrappers::Builder and store it in the given name.

[Validate]