我有一個使用複選框和文本區域的窗體。當我提交表單時,它會提交複選框的值(1或0),而不是來自文本區域的數據。以下是我的表格。在多個字段上使用相同值的軌道形式
<%= form_for(:add_kids) do |kid|%>
<div class="kidsname">
<%= kid.text_field :first_name, placeholder: "First", class: "name" %>
<%= kid.text_field :last_name, placeholder: "Last", class: "name" %>
</div>
<br>
<div class="allergens">
<h4>Allergens/Asthma:</h4>
<div class="allergens-list">
<ul>
<li>
<%= kid.check_box :soy %>
<%= kid.label :soy %>
<%= kid.check_box :peanuts %>
<%= kid.label :peanuts %>
<%= kid.check_box :wheat %>
<%= kid.label :wheat %>
</li>
<li>
<%= kid.check_box :milk %>
<%= kid.label :milk %>
<%= kid.check_box :nuts %>
<%= kid.label :nuts, "Tree Nuts" %>
<%= kid.check_box :eggs %>
<%= kid.label :eggs %>
</li>
<li class="otherNeeds">
<%= kid.check_box :other, {class: "other"} %>
<%= kid.label :other, "Other Needs" %>
<div class="concernsContainer">
<h3>Please type your kid's needs or concerns</h3>
<div class="concernsBox">
<%= kid.text_area :other, placeholder: "Type here...", maxlength: 500, disabled: 'disabled' %>
</div>
</div>
</li>
</ul>
</div>
</div>
<% end %>
這裏沒有問題,只有一個聲明... – tyler
爲什麼textarea被禁用? – Hesham
直到jQuery onclick事件纔會被禁用。問題是,爲什麼它從複選框而不是從textarea寫入值?謝謝 –