2
我在簡單的形式下面的行:導軌simple_form_for對比的form_for值/標題
<%= f.input :profile_name, label: false,
input_html: {:title => "Enter Username", :class => "field"} %>
此輸出:
<div class="input string required user_profile_name">
<input id="user_profile_name" class="string required field" type="text"
title="Enter Username" size="50" required="required" name="user[profile_name]"
maxlength="50" aria-required="true">
</input>
</div>
我具有規則的形式線應該是一樣的簡單的形式行:
<%= f.text_field :profile_name, :title => "Enter Username", :class => "field" %>
它輸出:
<input id="user_profile_name" class="field" type="text" value="Enter Username"
title="Enter Username" name="user[profile_name]">
</input>
規則形式表現正確。輸入字段內的「輸入用戶名」文本在點擊時會消失,如果沒有輸入內容則會重新顯示,並且在輸入其他內容時會消失。如何獲取simple_form的行爲方式?
謝謝,我試過佔位符屬性,但它不會消失,點擊像標題一樣使用常規窗體。 – Philip7899