Hello. I'm trying to have a select box in one of my views be observed
for change and have the value of the select box be accessible via
params[:name] in my controller. However, no matter what I try the select
parameters sent back to the server are always in params as "value =>
nil". That makes it quite difficult to get the value of the select box
since value is different for every selection.
Here is what I've tried.
1. Simple HTML approach
<select id="bird" name="bird">
<option value="3">Bald Eagle</option>
<%= observe_field("bird", :url => url(:avian, :hunt)) %>
2. Rails approach
<%= collection_select("avian", "avian_id", Avian.find(:all).sort,
:avian_id, :description, :include_blank => true) %>
<%= observe_field("avian_avian_id", :url => url(:avian, :hunt)) %>
In case 1 the parameters related to the select that appear with params
are "3 => nil". Similar feedback for case 2. In neither case is the
select in a form. I figured that is not necessary since my HTML is valid
and the observer is monitoring the select. I've tried wrapping the
select in a simple <form></form> but no luck.
Obviously I am missing something because I cannot find posts related to
this topic in this forum or elsewhere on the 'net. I'm trying to take
the simplest approach here. Can someone please clue me in? Thanks!