Forum: Ruby on Rails check all - check box problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
(Guest)
on 2007-08-01 01:50
(Received via mailing list)
I am not able to create a check box or a button that can check and
uncheckall the check boxes that i have created. It can be a check box
or button that checks and unchecks all the check boxes.

<form name="czar" action='<%= url_for(:action => "list_supplier") %>'
method='POST'>
<% i = 0 %>
<% @hotels.each do |hotel| %>
<%= check_box('hotel_', '', {}, hotel.group_name+i.to_s, '') %></td>
<% i = i + 1 %>
 <% end %>
<input type='submit' value='want to approve'/>


thanks in advance,
Czar
jg (Guest)
on 2007-08-01 06:36
(Received via mailing list)
I think the best way is to use javascript for checking and unchecking
all. Here is a good example that worked for me when I was doing
something similar.
http://snippets.dzone.com/posts/show/2818
also railscasts.com has a good screencast on checkboxes you might find
helpful.
This topic is locked and can not be replied to.