Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

simple_form f.hidden_field works, why not f.input?

= simple_form_for @foo do |f|

  # this works
  = f.hidden_field :asdf, :value => @some.thing

  # this works
  = f.input :asdf, :as => "hidden", :input_html => { :value => @some.thing }

  # Why doesn't this work, exactly?
  = f.input :title, :as => "hidden", :value => @some.thing

When I look at my log I see that value is coming through as an empty string in the latter input, but it's not clear to me why this is happening.

like image 542
Adam Fraser Avatar asked Dec 14 '12 23:12

Adam Fraser


1 Answers

f.hidden_field is a ActionView::Helpers::FormHelper while f.input belongs to SimpleForm.

The syntax is similar but has some differences.

like image 129
Helio Santos Avatar answered Oct 23 '22 07:10

Helio Santos