Forum: Ruby on Rails need help with check boxes

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
on 2007-07-28 02:20
(Received via mailing list)
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 can i get it? This is my scenario in rhtml file....

<form action="/admin/list_supplier" method='POST'>

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

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

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

<input type='submit' value='change to approve'/>

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,

Cynthia K. (Guest)
on 2007-07-28 03:46
(Received via mailing list)
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
This topic is locked and can not be replied to.