Sam Pierson
2007-Jun-13 19:31 UTC
Filtering object list with select_tags + pagination + Ajax for reactive refresh
With ruby 1.8.5 / Rails 1.2.3 I am trying to develop a page that: o Displays a list of objects. o Allows you to filter the list of objects using criteria selected from pulldown menus, o Paginates the objects with Prev and Next Page buttons. and here''s the fun part... o Refreshes the list every time a filter pulldown changes or a page button is clicked I''ve gotten this working without Ajax. My filters are select_tags and I have three submit_tags in the form: one called Refresh, one Prev Page and one Next Page. This provides my controller with all the filter settings in params[] and I can tell if a pagination button was clicked by looking at params[:commit], and I adjust the page number appropriately (I''m using the builtin paginator, but not the links it provides). Now to start adding Ajax. Problem 1: If I change form_tag to form_remote_tag, the params[:commit] trick no longer works - it is always set to "Refresh". It is probably bad HTML to have multiple submits in the same form and am probably using completely the wrong strategy to implement this. Any thoughts? Thanks, -Sam. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---