Hi, I have multiple checkboxes in a table each one representing an item. They are like this: [...] <td><%= check_box "incidencias_ids", incidencia.id %></td> <td><%=h incidencia.cliente.nombre %></td> [...] In the controller I have: incidencias_ids = params[:incidencias_ids] @incidencias = [] for id in incidencias_ids @incidencias << Incidencia.find_by_id(id) end I think this is enough to send all the checked checkboxes and manipulate them. But I don''t know how to send all the checkboxes to the controller! I know how to do it with link_to_remote but the answer is not displayed... How I can do this with link_to? Another way? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-07 19:18 UTC
Re: Sending multiple checkboxes values clicking a link
On 7 Mar 2009, at 18:45, Juan Kinunt wrote:> > Hi, > I have multiple checkboxes in a table each one representing an item. > They are like this: > > [...] > <td><%= check_box "incidencias_ids", incidencia.id %></td> > <td><%=h incidencia.cliente.nombre %></td> > [...]Try check_box_tag "incidencias_ids[]", incidencia.id There''s more about why this works (ie what the [] are about) in the guide on form helpers at guides.rubyonrails.org. Fred> > > In the controller I have: > > incidencias_ids = params[:incidencias_ids] > @incidencias = [] > for id in incidencias_ids > @incidencias << Incidencia.find_by_id(id) > end > > I think this is enough to send all the checked checkboxes and > manipulate > them. > But I don''t know how to send all the checkboxes to the controller! I > know how to do it with link_to_remote but the answer is not > displayed... > > How I can do this with link_to? Another way? > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---