passing multiple objects with remote_function

Hey,

I can successfully pass a single object from any form field to my controller via:

Select Year: <%= collection_select("vehicle", "year", @availableYears, "year", "year",                     {:prompt => "Select a year"},                     {:onchange => "#{remote_function(:url => {:action => "update_from_year"},                                                      :with => "'vehicle_year_id='+value")}"}) %></li>

What I would like to do is pass all the form values (4) to the controller with 1 :onchnage action.

My controller logic needs to replace different page elements according to what fields values are set. But the fields may change at different times and depending on there current values may need to change each other.

My thought was every time any of them changed send along the status of all of them so I may check them and act accordingly.

So if anyone knows how i can pass multiple values with :with => . Or another way to go about getting the values from the controller before updating the page that would be great. Thanks

Hi brianp

     You can use submit option with remote_function as with link_to_remote. Please check it here

http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M001645

Sijo

You could try using a :with like so:

:with => "$('form_element').serialize()")

where 'form_element' is the id of your form.