简体   繁体   中英

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.

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

The syntax is similar but has some differences.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM