I want to keep the select_tag(:multiple => true)
options to be selected which were selected by user once search is performed
<%= select_tag 'values[]', method_for_options_for_select, :class => 'some-class', :multiple => true, :size => 6 %>
Suppose a user select 4 values from the select tag then for values should be selected,
How can we pass this 4 values to the select_tag?
I tried using :selected => params['values[]']
yet this doesnt works for multiple true
Any assist will be appreciated
Ref this
& options_for_select
Something like following
<%= select_tag 'values[]', options_for_select(@stores.map {|s| [s.store_name, s.store_id]}, @user.stores.map {|j| j.store_id}),:class => 'some-class', :multiple => true, :size => 6 %>
No comments:
Post a Comment