This is the first time I have used remote_function and I'm unclear on why my code is not working as I would expect.
I am trying to have my select box load the specified action and pass a few params to it when an item is selected.
Here's an outtake of the code I have:
<% form_for(@order) do |f| %> <%= select(:state, :state, [['Alabama', 'AL'], ... ['Wyoming', 'WY']], {}, html_options = {:onchange => remote_function(:url => {:action => "new", :id => 74}, :with => "'state_test='+this.value", :method => :get)} ) %> <% end %>
I want it to call OrdersController#show, and according to my dev log it actually is, and it's passing all the desired params as well. Here's a log entry:
Processing OrdersController#show (for 127.0.0.1 at 2009-05-03 20:11:13) [GET] Session ID: a612ff378ef73097a30185e62e9ab64b Parameters: {"state_test"=>"NY", "action"=>"show", "authenticity_token"=>"b3ad00a2fdc2c467fcea159623d20470cfa54f8c", "id"=>"74", "controller"=>"orders"} Order Columns (47.0ms) SHOW FIELDS FROM `orders` Order Load (81.0ms) SELECT * FROM `orders` WHERE (`orders`.`id` = 74) Rendering template within layouts/orders Rendering orders/show Completed in 141ms (View: 7, DB: 129) | 200 OK [http://localhost/ orders/74? state_test=NY&authenticity_token=b3ad00a2fdc2c467fcea159623d20470cfa54f8c]
According to the log this thing should be working I'd think. But no matter what action I target the view never refreshes or is changed.
What am I doing wrong?
Thanks, Elliott