Getting & validating check_box input in button_to_function

Hi all,

Given below is a snippet of my ruby page.
While clicking on the Edit/Delete buttons, it should:

  1. Identify how many chk boxes are checked (If Edit, it should be one)
  2. Pass the chk box values (project ids) to the controller methods

I ended up nowhere. Please help me correct the code.

Select Name Code Description Manager Manager Email <% chkId = Array.new %> <% i = 0 %> <% for project in @projects %> <% i = i+1 %><% chkId[i] = project.id.to_s %><%= check_box_tag(chkId[i]) %> <%=h project.proj_name %> <%=h project.proj_code %> <%=h project.proj_desc %> <%=h project.manager %> <%=h project.mgr_email %> <% end %> <%= button_to_function ' Create ', remote_function(:update=>"project_creation", :url=>{:action=>'project_creation'}) %> <%= button_to_function ' Edit ', remote_function(:update=>"project_update", :url=>{:action=>'project_update'}), :before => "isSingleSelection()" %> <%= button_to_function ' Delete ', remote_function(:update=>"admin_project", :url=>{:action=>'delete_project'}, :confirm=>"Are you sure?", :method=>"delete") %>

Do appreciate your help.

Thanks,

Tony P.