我有haml使用formtastic来指定date_select输入(年,月,日):
= f.input :birthday, start_year: 1900, end_year: time.now.year-18, input_html: { class: 'select2' }
这使我有3个选择框与父元素类作为占位符:
<select ... placeholder=".span1">
如何指定占位符?年;月;日足够好 .
根据Formtastic Documentation:
<%= f.input :publish_at, :as => :date_select, :labels => { :year => "Year", :month => "Month", :day => "Day" } %>
[Edit]
如果使用 formtastic-bootstrap gem,您可能需要使用 :placeholder ,因为它在code上使用 . 虽然,在master上没有实现 :placeholder 选项,而是使用TODO注释 .
formtastic-bootstrap
:placeholder
1 回答
根据Formtastic Documentation:
<%= f.input :publish_at, :as => :date_select, :labels => { :year => "Year", :month => "Month", :day => "Day" } %>
[Edit]
如果使用
formtastic-bootstrap
gem,您可能需要使用:placeholder
,因为它在code上使用 . 虽然,在master上没有实现:placeholder
选项,而是使用TODO注释 .