How to get selection from multiple select list?

I have a multiple select list ( 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

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

thank you very much - I knew it had to be something pretty basic

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs