Jeff Miller wrote:
> Hey everyone,
>  This seems really elementary and I have no clue what is wrong... I have
> a form that has two multiple select boxes (using some javascript to
> shift items from the left select box to the right box and vice versa)
> and I want to grab what is in the second box after the user clicks
> submit. It seems that each time I try to get that info in my controller,
> it is returning nil. My form is as follows:
> 
> <%= form_tag :controller => 'push', :action => 'index', :type => 'test'
> -%>
> Choose users to sync (<%= @address_num %> total users)
> <select name="sel1" style="width:200px" size="10" multiple="multiple">
>   <% @address_array.each do |item| %>
>   <option value="<%= item %>"><%= item %></option>
>   <% end %>
> </select>
> <input type="button" value="--&gt;" onclick="moveOptions(this.form.sel1,
> this.form.sel2);" />
> <input type="button" value="&lt;--" onclick="moveOptions(this.form.sel2,
> this.form.sel1);" />
> 
> <select name="sel2" style="width:200px" size="10" multiple="multiple">
>   <option value="1">All Users (default)</option>
> </select>
> 
> <%= submit_tag 'submit' %>
> <%= end_form_tag -%>

pls try to name <select name="sel2[]"> like this (rest is same)
  <option value="1">All Users (default)</option>
</select>
In the controller pls try params[:sel2]||[]. I think this will give u
the all the values of all the selected options in the select drop down.
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to