Open yshmarov opened 3 years ago
actually, adding onchange: 'this.form.submit()'
to the javascript kind of helps:
(function() {
$(function() {
return $('.chosen-select').chosen({
onchange: 'this.form.submit()',
allow_single_deselect: true,
no_results_text: 'No results matched',
width: '200px'
});
});
}).call(this);
what is ur rails version? did using this.form.requestSubmit()
helps?
In Rail 7
<%= f.select :city, ["Berlin", "Chicago", "Madrid"] , {include_blank: "none"} ,onchange: "this.form.requestSubmit()" %>
<%= f.collection_select :user_id, User.all,:id,:email,{include_blank: "none"} , {onchange: "this.form.requestSubmit()"} %>
My code:
= select_tag :movie_id, options_for_select(Movie.map{|c| [c.to_s, c.id]}), { onchange: 'this.form.submit()', class: 'chosen-select' }
Expected behaviour: having added
onchange: 'this.form.submit()'
, whenever a value is selected the form gets submitted.Current behaviour: does not work with
onchange: 'this.form.submit()'