Czar.ruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jul-31 21:50 UTC
check all - check box problem
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
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. On Jul 31, 2:50 pm, "Czar.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <Czar.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---