I''ve got the following code in my view: <select name="user[member_list][]" multiple="multiple"> <%= options_from_collection_for_select @someUsers, "id", "username" %> </select> I have a few other fields, textboxes, etc. within the form. When I go to save the info, the textboxes all save with their content, but the select box doesn''t -- it displays values in it, no problem. When I print the contents of the params[:user] I see all the fields in the form along with their values except the Multi Select -- its nowhere to be found. I''ve tried naming it: user[member_list][] as well as: user[member_list] Neither works. -- Posted via http://www.ruby-forum.com/.
Upon further investigation I''ve found out that you have to have the items in the multiselect highlighted in order to have them save. This is problematic for me because I have two multiselects and I shuffle usernames between the two (user management). I don''t want to have to have the one multiselect highlight the choosen values for saving. Isn''t there a way just to save anything in a multiselect? -- Posted via http://www.ruby-forum.com/.
Write a javascript function that gets the select element and loops through the option children, setting each selected. Hook that up to the form''s onsubmit. Or, maybe someone''s done something in rails to make this for you... b Mark Haliday wrote:> Upon further investigation I''ve found out that you have to have the > items in the multiselect highlighted in order to have them save. This > is problematic for me because I have two multiselects and I shuffle > usernames between the two (user management). I don''t want to have to > have the one multiselect highlight the choosen values for saving. Isn''t > there a way just to save anything in a multiselect? > > >