Has anyone here had any experience using the ujs4rails plugin? I am encountering an issue where reloading working apply_behavior instances via ajax breaks them silently--causing the form in question to be submitted without js, reloading the page, and thus enabling the ajax again. Apparently this is an issue with how UJS caches the JS, but is there an available option I am missing that accounts for this? Thanks, Floyd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ljredpath-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-28 16:24 UTC
Re: UJS bug? Defect?
Hi Floyd, I''m not quite sure I follow what you mean. Could you give a more concrete example? Cheers Luke --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
tfwright-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-28 16:42 UTC
Re: UJS bug? Defect?
Ok, here is my specific set up: I''ve got a form for a model A and inside the form is a partial containg fields for an associated model B. Initially two sets of fields for B are loaded with the page, but the user can remove or add more fieldsets dynamically using button inputs. This is where I''ve implemented UJS: <% unless author.eql? @authors.first %> <%= content_tag "button", "Remove this author", :type => "submit", :id => "remove-author-#{index}", :name => "remove_author", :value => index %> <% apply_behavior "#remove-author-#{index}:click", remote_function(:url => {:action => :remove_author, :remove => index}, :update => "revision_authors", :submit => "revision_authors"), :prevent_default => true %> <% end %> <% if author.eql? @authors.last %> <%= content_tag "button", "Add another author", :type => "submit", :id => "add-author-#{index}", :name => "add_author" %> <% apply_behavior "#add-author-#{index}:click", remote_function(:url => {:action => :add_author}, :update => "revision_authors", :submit => "revision_authors"), :prevent_default => true %> <% end %> This works great first time I click either add or remove. The AJAX kicks in quite niceley and reloads the fields --one set for each author-- and those two apply_behavior calls. But after the ajax is complete and a set of fields has either been added or removed, none of the buttons work with AJAX. Instead they revert to their default behavior which is to submit the whole form. Also in case it''s helpful, I inspected the JS for the page before making the first AJAX request and there was a reference to /behaviours/action.js, but that file didn''t exist on the server. I appreciate your attempting to work me through this. Obviously I don''t fully comprehend how the caching works. Floyd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ljredpath-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-28 19:35 UTC
Re: UJS bug? Defect?
Hi Floyd, see my comments on the UJS trac. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---