컨트롤러에서 특정 방법으로 양식을 제출해야합니다. 어떻게해야합니까? 내 양식은 다음과 같습니다양식을 특정 방법에 제출하는 방법은 무엇입니까?
내가 제출할<%= form_tag({update_holidays_path, method: 'post'},{name: "exchange", id: "exchange"}) do %>
<table width="auto" border="0">
<thead>
<th scope="col">Selected</th>
<th width="50" scope="col"> </th>
<th scope="col">Holidays</th>
</thead>
<tbody>
<tr>
<td>
<% holidays_array = @group.holidays.all.map { |holiday| [holiday.name, holiday.id] } %>
<%= select(:holiday_id, :name, options_for_select(holidays_array),{},
{:multiple => true, :style => "width: 300px; background-color: #9FE", :width => "300", :size => 20, :id=>"left" } ) %>
</td>
<td align="center">
<%= link_to "<<", {anchor: "", remote: true}, {id: "toleft" , w_command: "add_holiday", w_auth: form_authenticity_token , w_controller: "groups", w_id: @group.id} %>
<br /><br />
<%= link_to ">>", {anchor: "", remote: true}, {id: "toright" , w_command: "rem_holiday", w_auth: form_authenticity_token , w_controller: "groups", w_id: @group.id} %>
</td>
<td>
<% holidays_array = Holiday.all.map { |holiday| [holiday.name, holiday.id] } %>
<%= select(:holiday_id, :name, options_for_select(holidays_array),{},
{ :multiple => true, :style => "width: 300px; background-color: #F99", :width => "300", :size => 20, :id=>"right" }) %>
</td>
</tr>
</tbody>
</table>
내 다음과 같은 자바 스크립트와 선택 왼쪽 :
var save=function()
{
alert("0");
var left = document.getElementById("left");
alert(left);
var result = document.exchange;
alert(result);
result= ""
alert("3");
for(i=0;i<right.length;i++)
{
result.value=result.value+","+left.options[i].value; //right.options[i].selected = true;
alert("4,"+i+" "+result.value);
}
alert("5");
result.submit();
}
이 작업을 수행 할 수있는 방법이 있습니까?