I have a multiple select list (<select> with multiple=''multiple'') in one of my view templates. I can select several items from the list - items with values: 3,4,5. I can see, using Tamper Data in Firefox, that the selection is being returned. (POSTDATA=danceselect=3&danceselect=4&danceselect=5&commit=Doit) ''danceselect'' is the name of listbox. params[''danceselect'') contains only one item (''3'' in this case) QUESTION: how do I get all of the items selected? Nothing fancy here - I need the selected items to get info from the DB. What have I missed? Thanks, Warren --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2007-Jul-04 04:21 UTC
Re: how to get selection from multiple select list?
> I have a multiple select list (<select> with multiple=''multiple'') in > one of my view templates. > > I can select several items from the list - items with values: 3,4,5. > > I can see, using Tamper Data in Firefox, that the selection is being > returned. > (POSTDATA=danceselect=3&danceselect=4&danceselect=5&commit=Doit) > > ''danceselect'' is the name of listbox. > > params[''danceselect'') contains only one item (''3'' in this case) > > QUESTION: how do I get all of the items selected? Nothing fancy here > - I need the selected items to get info from the DB. > > What have I missed?Change the name of your select to "danceselect[]"... that is, make sure the HTML output looks like this: <select name="danceselect[]"....> .... -philip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
thank you very much - I knew it had to be something pretty basic On Jul 4, 12:21 am, Philip Hallstrom <r...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > I have a multiple select list (<select> with multiple=''multiple'') in > > one of my view templates. > > > I can select several items from the list - items with values: 3,4,5. > > > I can see, using Tamper Data in Firefox, that the selection is being > > returned. > > (POSTDATA=danceselect=3&danceselect=4&danceselect=5&commit=Doit) > > > ''danceselect'' is the name of listbox. > > > params[''danceselect'') contains only one item (''3'' in this case) > > > QUESTION: how do I get all of the items selected? Nothing fancy here > > - I need the selected items to get info from the DB. > > > What have I missed? > > Change the name of your select to "danceselect[]"... that is, make sure > the HTML output looks like this: > > <select name="danceselect[]"....> > .... > > -philip--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---