This project is archived and is in readonly mode.

#6331 ✓invalid
John Woods

select_tag ignores :multiple option

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

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.

Comments and changes to this ticket

  • andrehjr (at gmail)

    andrehjr (at gmail) January 28th, 2011 @ 05:05 AM

    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 %>
    
  • Rohit Arondekar

    Rohit Arondekar January 28th, 2011 @ 05:42 AM

    • 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.

  • Rohit Arondekar

    Rohit Arondekar March 14th, 2011 @ 06:58 AM

    • State changed from “new” to “invalid”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages