Need help with check boxes


#1

Hello everybody,

I have created check box in an rhtml file and want to have its id and
name of all the items that are checked, in controller class that it is
linked to…how can i get it? This is my scenario in rhtml file…

<% i = 0 %>
<% @hotels.each do |hotel| %>

<input type=“checkbox” id="<%=hotel.group_name%>_<%=i%>" name="<
%=hotel.group_name%>[<%=i%>]" value= “<%=i%>” onclick=“submit”

Wanna…Aproove?

<% i = i + 1 %>
<% end %>

The value of @hotels, i am getting from controller where one of the
column is group_name.
So how can get the id, name and value of the items checked in the
concern controller class(admin).
Any help would be really appreciated,
thanks in advance,
Czar

Online


#2

Why are you using an artificial counter (i) rather than the id column
of the hotel?

I would suggest this Wiki article as a good place to look for a
variety of suggestions
http://wiki.rubyonrails.org/rails/pages/CheckboxHABTM