plataformatec/simple_form — Issue #510: Hidden fields get quoted as &lt; &gt;
Author: pmontrasio
Created: 2012-03-09 00:01:21+00:00
State: open

In simple_form 2.0.1 on Rails 3.0.12 this code

<%= simple_form_for(@model) do |f| %>
<%= f.input :field, :as => :hidden, :input_html => {:value => "the value"} %>

produces

<input class="hidden" id="model_field" name="model[field]" type="hidden" value="field" />

Actually I think these are two bugs in one because there is no need for hidden fields to be enclosed in a div. Just a

would be enough.

This is my configuration:

SimpleForm.setup do |config|
config.wrappers :browser_validations => false,
:label_html => { :class => 'input-field-container' },
:class => :field,
:error_class => [:field_with_errors, 'ui-widget ui-corner-all shadow'] do |b|
b.use :html5
b.use :placeholder
b.use :label_input, :wrap_with => { :text => lambda {
|label, required| "#{label}#{required}" }
}
b.use :hint, :wrap_with => { :tag => :span, :class => :didascalia }
b.use :error, :wrap_with => { :tag => :p, :class => :error }
end
end