lundi 14 septembre 2015

Change Form To Tick Box With Multi Select

Hello fello Stockexchangers. I have a simple Category view that allows you to select one size.

However I want the user to be able to select multiple sizes. So a user can create a Shirt Category and select from multiple sizes available in check/tick box form. So they can just tick all the sizes they want for their category.

How to turn this view into check boxes for sizes? Select more then 1 size?

Here is the view

<div class="container">
  <div class=“row”>
    <div class="col-md-6 col-md-offset-3">
      <div class="panel panel-primary">
        <div class="panel-body">
            <%= simple_form_for(@category) do |f| %>
                <div class="form-inputs">
                <%= f.input :name %>
                <%= f.collection_select :size_id, Size.order(:title), :id, :title, include_blank: true, :multiple => true, :prompt => "Select One Size" %>
                <%= f.collection_select :parent_id, Category.order(:name), :id, :name, {prompt: "Select Parrent ID If Applicable"},include_blank: true %>
                </div>
                <div class="form-actions"><%= f.button :submit %></div>
           <% end %>
        </div>
      </div>    
    </div>
  </div>
</div>

Aucun commentaire:

Enregistrer un commentaire