Using Rails 2, I have multiple objects in a form and am using fields_for. My
problem is creating a multi select and sending that off to the controller as
a hash.
In my erb, I have ....
<% teacher.fields_for :qualifications do |qual_form| %>
<%= qual_form.select [], @qualifications, { :multiple => true, :size
=>
5, :disabled => false } %>
which produces a non-multi select .....
<select id="teacher_qualifications_"
name="teacher[qualifications][]">
<option value="5">Licence</option>
<option value="1">NPLQ</option>
<option value="3">Teacher''s Level One</option>
<option value="4">Teacher''s Level Two</option>
<option value="2">Teacher''s Rescue Test</option>
</select>
which sends "qualifications"=>["5"] to the controller and
not
qualifications"=> { ["5"] }
The HTML produced looks almost right but isn''t. I can send a hash of
information with a <%= qual_form.text_field :id %> for example but I need
a
select.
I''ve tried select_tag and although I''m able to get a multi
select going on,
I still can''t send a hash.
<%= select_tag "teacher[qualifications][]", options_for_select(
@qualifications, @selected_qualifications ),
{ :multiple => true, :size => 5, :disabled => false,
:id
=> "qualifications" } %>
Can someone help me, please.
Thank you
--
100% naturally selected. 0% designed.
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---