Reputation: 189
I am using the select2 gem in a rails app, I cannot get the form to accept multiple values in my ("id").select2()
I would like it to detect the multiple:true attribute in my jquery and not in my select input but it doesn't work for me
for example:
this is my imput tags
= f.input :tag_ids, collection: [], input_html: { class: "js-example-basic-multiple js-example-responsive", id: "js-customer"}, include_blank: false
my jquery
$("#js-customer").select2({
maximumSelectionLength: 5,
minimumInputLength: 1,
multiple: true,
tags: true,
data: (#{Tag.order(:name).map{|tag| {id: tag.id, text: tag.name}}.to_json.html_safe}),
});
What I am looking for is that I detect the multiple:true attribute in my jquery
Upvotes: 0
Views: 63
Reputation: 3767
Try adding the multiple attribute to the input Tag:
<%= f.input :tag_ids, collection: [], input_html: { class: "js-example-basic-multiple js-example-responsive", id: "js-customer", multiple: true}, include_blank: false %>
Upvotes: 0