フォームヘルパーで readonly => true を設定するのに問題があります。それでも選択を変更できます。これが私のコードです。
<%= f.date_select :date_of_birth, {:order => [:day, :month, :year]}, {:readonly => true} %>
フォームヘルパーで readonly => true を設定するのに問題があります。それでも選択を変更できます。これが私のコードです。
<%= f.date_select :date_of_birth, {:order => [:day, :month, :year]}, {:readonly => true} %>
このreadonly
オプションはHTML<select>
タグまたはタグには存在せず、 <otption>
Railsでさえそのようなオプションを魔法のようにHTMLに追加することはできません。
代わりに、を使用:disabled => true
して、選択フィールドを「無効」として表示できます。
f.date_select :date_of_birth, {:disabled => true, :order => [:day, :month, :year]}
詳細については、date_select
ドキュメントを参照してください。