1

How would one set:id => simpleformコレクション入力フィールドの "myvalue"? およびまたは補足として、id => "age_from" のように age_from の ID を設定しようとしても、両方を行う方法がわかりません。これらに関するドキュメントが非常に不足しているようです。

私が思いつくことができるすべての可能な組み合わせを試しました:

= f.input_field :age_to,
  :label => "Age from",
  :collection => 18..60,
  :select => 19 <------- set this to '19' for this collection?
  :style => "width: 50px !important",
  :id => "myid" <------- how to set id for this collection?
4

3 に答える 3

6
f.input_field:age_to、:label => "Age from"、:collection => 18..60、
:selected => 19、:style => "width:50px!important"、:input_html => {:id => "myid"}

選択した値を設定して表示することが機能することを願っていidます!!!

于 2012-08-30T18:45:22.103 に答える
1

SimpleFormを使用している場合は、次のようにします。

= f.input :age_to, .., :input_html => { :id => 'myid' }
于 2012-08-30T18:44:12.360 に答える
1

試す:

= f.input :age_to, :label => "Age from", :collection => 18..60, :value_method => 19, :input_html => { :id => 'myid' }
于 2012-08-30T18:46:51.037 に答える