Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

select_tag ignores :multiple option

#6331

Normally, select_tag should allow a :multiple option, which produces:

<select id="..." multiple>...</select>
In 3.1 beta, the :multiple option is ignored. This is true not only for select_tag, but for all of the helper methods that make use of select. I have tested collection_select and FormHelper select.
<%= form_for :neighborhood do |f|
  f.label :species_ids, 'species'
  f.select :species_ids, [['Human', 'Hs'], ['Mouse', 'Mm'], ['Yeast', 'Sc']], :multiple => true
<% end %>

This produces a drop-down list when it should produce a multi-select box.

Reported by John Woods · January 24th, 2011 @ 09:52 PM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. andrehjr (at gmail)
    andrehjr (at gmail)

    I think you're missing a {} in the f.select.. select and select_tag are both working properly on rails@master

    <%= form_for :neighborhood do |f| %>
      <%= f.select :species_ids, [['Human', 'Hs'], ['Mouse', 'Mm'], ['Yeast', 'Sc']], {}, :multiple => true %>
      <%= select_tag :species, options_for_select([['Human', 'Hs'], ['Mouse', 'Mm'], ['Yeast', 'Sc']]), :multiple => true %>
    <% end %>
    

    January 28th, 2011 @ 05:05 AM

  2. Rohit Arondekar
    Rohit Arondekar
    • Importance changed from to Low

    John, did that solve your problem? I believe it should. Do comment back here if it did so that I can close the ticket.

    January 28th, 2011 @ 05:42 AM

  3. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to invalid

    March 14th, 2011 @ 06:58 AM