Forum: Ruby on Rails retrieving value from select

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eric M. (Guest)
on 2006-01-19 01:15
In my view, I have:
<%= select("division_filter", "division_id", Division.find_all.collect
{|p| [ p.division, p.id ] }, { :include_blank => true }) %>

How do I retrieve the division_id in my controller?
Eric M. (Guest)
on 2006-01-19 01:34
FYI, here is the HTML generated by the above:

<select id="division_filter_division_id"
name="division_filter[division_id]">
  <option value=""></option>
  <option value="1">Division1Name</option>
  <option value="2">Division2Name</option>
  <option value="3">Division3Name</option>
  <option value="4">Division4Name</option>
</select>
Wilson B. (Guest)
on 2006-01-19 02:24
(Received via mailing list)
On 1/18/06, Eric M. <removed_email_address@domain.invalid> wrote:
> FYI, here is the HTML generated by the above:
>
> <select id="division_filter_division_id"
> name="division_filter[division_id]">
>   <option value=""></option>
>   <option value="1">Division1Name</option>
>   <option value="2">Division2Name</option>
>   <option value="3">Division3Name</option>
>   <option value="4">Division4Name</option>
> </select>

In your controller,
params[:division_filter][:division_id]
will contain the selected value.
Eric M. (Guest)
on 2006-01-19 05:52
Thank you very much.
This topic is locked and can not be replied to.