1

Ok, I have a multi select box controlled by chosen jquery plugin.

I can get multi select working without ajax, and ajax working without multiselect, but not the two together.

Here multi select works, but reloads the whole page when an item is selected (remote not working)

<%= f.collection_select :genre_cont_any, [t('genre.alternative'), t('genre.blues'), t('genre.children'), etc etc etc.............. ], :to_s, :to_s, {}, { :multiple => true, remote: true, onchange: "this.form.submit();" } %>

Here ajax works fine, reloading my list only, but I can only select one option at a time (multiple not working)

<%= f.collection_select :genre_cont_any, [t('genre.alternative'), t('genre.blues'), t('genre.children'), etc etc etc.............. ], :to_s, :to_s, {},:data => { :multiple => true, :remote => true, onchange: "this.form.submit();" }} %>

I want to be able to multi select, and with each new addition, to send an ajax request and reload the list.

Any advice on linking everything would be great! Thanks!

4

1 回答 1

0

Figured it out:

<%= f.collection_select :genre_cont_any, [t('genre.alternative'), t('genre.blues'), t('genre.children'), etc etc etc.............. ], :to_s, :to_s, {},:data => { :remote => true, onchange: "this.form.submit();" }, :multiple => true %>
于 2016-01-28T16:42:04.723 回答