[英]How to specify placeholders for date_select in rails?
我有使用格式來指定date_select輸入(年,月,日)的haml:
= f.input :birthday,
start_year: 1900,
end_year: time.now.year-18,
input_html: { class: 'select2' }
這使我獲得了3個帶有父元素類作為占位符的選擇框:
<select ... placeholder=".span1">
如何指定占位符? 年;月;日就足夠了。
根據Formtastic文檔 :
<%= f.input :publish_at, :as => :date_select, :labels => { :year => "Year", :month => "Month", :day => "Day" } %>
[編輯]
如果formtastic-bootstrap
gem,則可能需要使用:placeholder
因為它已在代碼中使用 。 但是,在總體上 , :placeholder
選項未實現,而是使用TODO注釋。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.