I have this list of users that I want to include in a group. I choose these users from a larger group - all the employees for a company , for example. I have both lists displayed on the page, the thing is that when I choose a user to include in my list I want to have that user shown in the list (update that list) but also have that user taken out of the other list. So basically I need to update two divs. I am using a form_remote_tag to :update the one div, but how do I update the second. Is there a way to update two divs as a result of an action? thanks, -S -- 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 -~----------~----~----~----~------~----~------~--~---
Shandy Nantz wrote:> Is there a way to update two divs as a result of an action? thanks,RJS templates is one: page.insert_html :bottom, ''thoughts'', :partial => ''thought'' page.visual_effect :highlight, ''thoughts'' page.form.reset ''thought-form'' This tutorial is long-winded but it''ll give you the basics: http://ajax.stealthsettings.com/rjs-templates-for-rails/rjs-templates-for-rails-what-is-rjs/ Then check out the docs: http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html -- 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 -~----------~----~----~----~------~----~------~--~---
Shandy Nantz wrote:> I have this list of users that I want to include in a group. I choose > these users from a larger group - all the employees for a company , for > example. I have both lists displayed on the page, the thing is that when > I choose a user to include in my list I want to have that user shown in > the list (update that list) but also have that user taken out of the > other list. So basically I need to update two divs. I am using a > form_remote_tag to :update the one div, but how do I update the second. > Is there a way to update two divs as a result of an action? thanks, > > -SHi You can update two divs using :update =>"div1,div2" in form_remote_tag and also by using render :update do |page| page.replace_html ''div1'', :partial => ''file1'' page.replace_html ''div2'', :partial => ''file2'' in the controller -- 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 -~----------~----~----~----~------~----~------~--~---
Abhi Manyu wrote:> Shandy Nantz wrote: >> I have this list of users that I want to include in a group. I choose >> these users from a larger group - all the employees for a company , for >> example. I have both lists displayed on the page, the thing is that when >> I choose a user to include in my list I want to have that user shown in >> the list (update that list) but also have that user taken out of the >> other list. So basically I need to update two divs. I am using a >> form_remote_tag to :update the one div, but how do I update the second. >> Is there a way to update two divs as a result of an action? thanks, >> >> -S > > Hi > You can update two divs using :update =>"div1,div2" in form_remote_tag > and also by using > render :update do |page| > page.replace_html ''div1'', :partial => ''file1'' > page.replace_html ''div2'', :partial => ''file2'' > > in the controllerThis doesn''t work at all, at least not for me. I have a form_remote_tag with :update => ''div1, div2'' and then in my controller I have the above code. If I leave off the :update, my button for the form act as if they haven''t been hit and with the update I get the same behavior. Is there something that I''m missing? Thanks, -S -- 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 -~----------~----~----~----~------~----~------~--~---
Shandy Nantz wrote:> > This doesn''t work at all, at least not for me. I have a form_remote_tag > with :update => ''div1, div2'' and then in my controller I have the above > code. If I leave off the :update, my button for the form act as if they > haven''t been hit and with the update I get the same behavior. Is there > something that I''m missing? Thanks, > > -SI take that back, it is working - kinda, but I think my issue is in my code seperate then from your code Abhi. I removed the :update in the form tags and that seemed to help a lot. Thanks, -S -- 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 -~----------~----~----~----~------~----~------~--~---
Shandy Nantz wrote: I removed the :update in the> form tags and that seemed to help a lot. Thanks,Correct. When you use RJS templates you should not specify the :update argument in your Ajax calls. -- 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 -~----------~----~----~----~------~----~------~--~---