I'm new to Ruby, Rails and Ajax and I'm trying to do something seemingly simple. I am trying to use a value someone supplies in a form in another form that is dynamically generated using Ajax.
I have the following code:
<div id="race_table"> </div>
<%= form_remote_tag(:update => "race_table", :url => { :action => "update_races" }) %> <table> <tr> <td>Ruleset:</td> <td><%= select(:post, :ruleset, @rulesets) %></td> </tr> <tr> <td colspan="2"><%= submit_tag "Find Races" %></td> </tr> </table> <%= end_form_tag %>
Which has been changed umpteen times, but this is how it stands now and I'm thinking it should be accurate. @rulesets contains an array of arrays such that it prints something like <option value="1">Ruleset #1</option>
Then I have the update_races action of the same module. It does several things but most notably (and stripped down at the moment it does)
@ruleset = params[:ruleset] || 11 render :layout => false
Then I have the update_races.rhtml file which does lots of things but ultimately does:
<%= @ruleset %>
And ruleset is ALWAYS 11. For some reason params[:ruleset] is always nil. My browser is Firefox 2.0.0.6
Please help