class SimpleForm::FormBuilder

def input_field(attribute_name, options = {})




- when the input is invalid:



- when the input is valid:

the class configured according to the validation:
When the validation happens, the input will be rendered with

end
f.input_field :name
simple_form_for @user do |f|

end
config.input_field_error_class = 'is-invalid'
config.input_field_valid_class = 'is-valid'
SimpleForm.setup do |config|
# config/initializers/simple_form.rb

It also support validation classes once it is configured.

name="user[name]" type="text" value="Carlos" />

This is the output html (only the input portion, not the form):

end
f.input_field :name
simple_form_for @user do |f|

== Examples

are sent as :input_html.
Creates a input tag for the given attribute. All the given options
def input_field(attribute_name, options = {})
  components = (wrapper.components.map(&:namespace) & ATTRIBUTE_COMPONENTS)
  options = options.dup
  options[:input_html] = options.except(:as, :boolean_style, :collection, :disabled, :label_method, :value_method, :prompt, *components)
  options = @defaults.deep_dup.deep_merge(options) if @defaults
  input      = find_input(attribute_name, options)
  wrapper    = find_wrapper(input.input_type, options)
  components = build_input_field_components(components.push(:input))
  SimpleForm::Wrappers::Root.new(components, wrapper.options.merge(wrapper: false)).render input
end