I''m trying to do an ajax call when the select (drop down) gets changed. What''s the best way to do this? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, Mar 27, 2008 at 9:03 AM, Jimmy Palmer <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I''m trying to do an ajax call when the select (drop down) gets changed. > What''s the best way to do this?I wrote up something similar here: http://lindsaar.net/2008/2/25/javascript-field-monitor This is a javascript file that monitors every input and select on a form and highlights it if it changes. You can replace the highlight code with an AJAX call if you want. Regards Mikel --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Here''s how to put an observer on a select box: VIEW: <%= select_tag :card_type, %{<option value="">Please Select...</option>} + options_for_select(supported_card_types) %> <%= observe_field :card_type, :frequency => 0.5, :url => {:action => :display_card_fields, :only_path => :false}, :with => "''card_type=''+encodeURIComponent(value)" %> This calls RJS file "display_card_fields.js.rjs" when the select box changes, sending the value card_type in the params hash. Hope this helps you :) -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---