Jump to content

The ultimate community for Ruby on Rails developers.


Photo

how to change a list of checkboxes to a multiple selection input

input

  • Please log in to reply
No replies to this topic

#1 anmaree@annarbortees.com

anmaree@annarbortees.com

    Passenger

  • Members
  • 1 posts

Posted 08 November 2013 - 05:39 PM

I have a set of checkboxes that I want to turn into a multiple selection input:

<div id="taxons_offered">
<h3>Taxonomies Offered In</h3>
<% for store in Store.all %>
<% if store.has_taxonomies? %>
<div store_id='
<%= store.id %>'>
<h4><%= store.name %></h4>
<ul class="multi-column-checkbox">
<% for taxonomy in store.taxonomies %>
<li><%= check_box_tag "idea[taxonomy_ids][]",
taxonomy.id, @idea.taxonomies.include?(taxonomy) %> <%= taxonomy.name %></li>
<% end %>
</ul>
</div>
<% end %>
<% end %>

 

I tried replacing check_box_tag with collection_select but it breaks






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users