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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
You could try using a :with like so: :with => "$(''form_element'').serialize()") where ''form_element'' is the id of your form. On Jan 30, 12:21 am, brianp <brian.o.pea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe Matching Threads
- dynamic drop downs for product search
- [Bug 70212] New: glxinfo triggers assert in cso_release_all after 3f0627c2ad6
- Function Testing Reloading Fixtures before assertion
- Using link_to_remote/remote_function outside of a Controller
- [Rails 3] remote_function ?