Hi, I want to make a selection list, which I call a dropdown, which, when a user makes his or her selection, will do an ajax call, and update a partial. Without hitting a button -- the ajax request will fire off upon the selection. I''d appreciate a hint -- can''t figure out where to start. Charlie --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Charlie, The Agile Book is always a good place to start looking for things Rails. In your case, page 523-526 in the 2nd Edition has some good stuff that can get you started on what you want. Regards, Rajesh On Aug 18, 10:21 am, charlie caroff <charlie.car...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I want to make a selection list, which I call a dropdown, which, when > a user makes his or her selection, will do an ajax call, and update a > partial. Without hitting a button -- the ajax request will fire off > upon the selection. > > I''d appreciate a hint -- can''t figure out where to start. > > Charlie--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Is a form observer the way to go with this? I was thinking of just doing an onchange, so that when any element is selected, it fires off an ajax request. On Aug 18, 12:16 am, "K. Rajesh" <kaviraj...-uAjRD0nVeow@public.gmane.org> wrote:> Charlie, > > The Agile Book is always a good place to start looking for things > Rails. In your case, page 523-526 in the 2nd Edition has some good > stuff that can get you started on what you want. > > Regards, > Rajesh > > On Aug 18, 10:21 am,charlie caroff<charlie.car...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > I want to make a selection list, which I call a dropdown, which, when > > a user makes his or her selection, will do an ajax call, and update a > > partial. Without hitting a button -- the ajax request will fire off > > upon the selection. > > > I''d appreciate a hint -- can''t figure out where to start. > > > Charlie--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Either way would work. I prefer to write less javascript and let the observer deal w/ the ajax request, but they will both do basically the same thing one is a little more rails, the other a little more javascript. charlie caroff wrote:> Is a form observer the way to go with this? I was thinking of just > doing an onchange, so that when any element is selected, it fires off > an ajax request. > > On Aug 18, 12:16 am, "K. Rajesh" <kaviraj...-uAjRD0nVeow@public.gmane.org> wrote: > >> Charlie, >> >> The Agile Book is always a good place to start looking for things >> Rails. In your case, page 523-526 in the 2nd Edition has some good >> stuff that can get you started on what you want. >> >> Regards, >> Rajesh >> >> On Aug 18, 10:21 am,charlie caroff<charlie.car...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> >>> Hi, >>> >>> I want to make a selection list, which I call a dropdown, which, when >>> a user makes his or her selection, will do an ajax call, and update a >>> partial. Without hitting a button -- the ajax request will fire off >>> upon the selection. >>> >>> I''d appreciate a hint -- can''t figure out where to start. >>> >>> Charlie >>> > > > > >-- Sincerely, William Pratt http://www.billpratt.net billp-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I use observers for this all the time doing exactly what you want. I use it in my pagination footer. I give the user a list of available pages, and if a new page is chosen, the observer fires off an ajax request which then uses rjs to update the page results. K. Rajesh wrote:> Charlie, > > The Agile Book is always a good place to start looking for things > Rails. In your case, page 523-526 in the 2nd Edition has some good > stuff that can get you started on what you want. > > Regards, > Rajesh > > On Aug 18, 10:21 am, charlie caroff <charlie.car...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hi, >> >> I want to make a selection list, which I call a dropdown, which, when >> a user makes his or her selection, will do an ajax call, and update a >> partial. Without hitting a button -- the ajax request will fire off >> upon the selection. >> >> I''d appreciate a hint -- can''t figure out where to start. >> >> Charlie >> > > > > >-- Sincerely, William Pratt http://www.billpratt.net billp-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
By way of an example: The default for observe field is on change so the call to remote occurs whenever a selection is made: <%= select ''order'', ''ship_method'', [''1st Class Standard'', ''1st Class Recorded'',''Next Day Courier'', ''Special Delivery'' ]%> ........ <%= observe_field :order_ship_method, :url=>url_for(:action=>:edit_batch_field, :controller=>''order'', :id=>@order.id), :with=>"ship_method" %> hth Tonypm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Very good. Thanks to all. This is one of those things where I didn''t know what to look for in the first place. Got it working now. On Aug 18, 10:54 am, tonypm <tonypmar...-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> By way of an example: > > The default for observe field is on change so the call to remote > occurs whenever a selection is made: > > <%= select ''order'', ''ship_method'', > [''1st Class Standard'', ''1st Class Recorded'',''Next Day > Courier'', ''Special Delivery'' ]%> > > ........ > > <%= observe_field :order_ship_method, > :url=>url_for(:action=>:edit_batch_field, > :controller=>''order'', :id=>@order.id), > :with=>"ship_method" > > %> > > hth > Tonypm--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---