I''m having some problems with this link_to_remote call. What I want ideally is if the user needs more information they can click on the name and have the details show up. I want to only make the query for more information when they click rather than loading all the information and hiding it from the start (no need to send info that will never be displayed). Once they click for more details they can toggle the details to show or hide by clicking the same name. So ideally I want the first click to go and get the info and then subsequent clicks to toggle the display of the info. What I have now does that; it will go and get it with the link_to_remote call, but once it is finished it will blind up immediately. I basically want the blind to stay down with freshly retrieved data. Below is the code: <%= link_to_remote( child.value.to_s, :update => container, :url =>{ :action => :add_children}, :with => withText, :success =>visual_effect(:toggle_blind, container, :duration => 0.2) )%> Any suggestions would be greatly appreciated, Chris -- 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 -~----------~----~----~----~------~----~------~--~---
sounds like what you want is first click requests and shows. second click hides the data, third click shows again. So, try <script type="text/javascript"> function show_hide_with_ajax(element, t){ e = $(element) if(e.innerHTML != ''''){ new Ajax.Updater(e, <%= url_for(:action => :add_children) %>, {asynchronous:true, evalScripts:true, onComplete:function(request){e.className = "on"}}); }else{ if(e.className == "on"){ e.className = "on" }else{ e.className = "off" } } } </script> link_to child.value.to_s, ''#'', { :onclick => "show_hide_with_ajax(#{container}, #{withText})"} -- 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 -~----------~----~----~----~------~----~------~--~---
Great thanks Keynan, I had to modify that code a little bit, but it sure helped. Everything is working as it should. Except when I scroll down and click a link further down the page, it will pop me back up to the top of the page. The action happened as it should, but I need to scroll back down to where I was. Kind of annoying. Any suggestions? -- 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 -~----------~----~----~----~------~----~------~--~---