0
我想在Ruby on Rails中使用簡單的html5表單。我的字段集代碼:如果選擇幾個選項,選擇html5表單只會發送一個結果
<fieldset class="form-group">
<legend><%= question.title %></legend>
<% question.answers.each do |answer| %>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" name="question-<%= question.id %>" value="answer-<%= answer.id %>">
<%= answer.title %>
</label>
</div>
<% end %>
</fieldset>
顯示正確的,當我選擇一個或多個選項,並提交,我有要求只有一個參數,因爲它是單選按鈕形式,但我選擇了幾個變種:
{"question-162"=>"answer-467"}
如何使這個表單工作正確,並在提交請求中發送乘法參數?
你是完全正確的! –