Select multiple question

I’ve got the following code in my view:

<%= options_from_collection_for_select @someUsers, “id”, “username” %>

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:

Neither works.

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…


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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs