I''m trying to build an WebFTP application in Rails for some practice. Here is a link located in a partial named _display_file that is called by a partial named _list_files. A similar link is created for every directory in the FTP <%= link_to_remote filename , :url => {:action => ''chdir'' , :ftp_dir => filename}, :update => ''ftp_div'' %> It should, to my understanding, make a call to the ''chdir'' action and use the results to update the ftp_div. The controller action ''chdir'' is shown below: def chdir @ftp = session[''ftp''] @ftp.chdir( params[ :ftp_dir ] ) session[''ftp''] = @ftp @list = @ftp.list("-a") end btw, I can store the ftp object inside a session because I''ve enabled memory_cache instead of other session types. So that''s not the issue, it works without the AJAX. Finally the file chdir.rjs is shown below: page.replace_html("ftp_div" , :partial => "list_files" , :object => @list) So basically, the user should be able to click on the directory and the directory listing should be updated without a page refresh. Instead I get this error when click on one of the links: RJS error: TypeError $(element) has no properties Afterwords I get a "notice" box containing what appears to be the code I would like to appear in the ftp_div division... It looks something like this: Element.update("ftp_div", "<!-- Start FTP List table --> <table border=\"1\"> etc... with the etc... being replaced by the content that should be showing in the browser. Any suggestions would be appreciated. -- 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 -~----------~----~----~----~------~----~------~--~---
Joe Smith wrote:> I''m trying to build an WebFTP application in Rails for some practice. > > Here is a link located in a partial named _display_file that is called > by a partial named _list_files. A similar link is created for every > directory in the FTP > > <%= link_to_remote filename , > :url => {:action => ''chdir'' , :ftp_dir => filename}, > :update => ''ftp_div'' %> > > It should, to my understanding, make a call to the ''chdir'' action and > use the results to update the ftp_div. > > The controller action ''chdir'' is shown below: > > def chdir > @ftp = session[''ftp''] > > @ftp.chdir( params[ :ftp_dir ] ) > session[''ftp''] = @ftp > @list = @ftp.list("-a") > end > > btw, I can store the ftp object inside a session because I''ve enabled > memory_cache instead of other session types. So that''s not the issue, > it works without the AJAX. > > Finally the file chdir.rjs is shown below: > > page.replace_html("ftp_div" , :partial => "list_files" , :object => > @list) > > > > So basically, the user should be able to click on the directory and the > directory listing should be updated without a page refresh. Instead I > get this error when click on one of the links: > > > > RJS error: > > TypeError $(element) has no properties > > Afterwords I get a "notice" box containing what appears to be the code > I would like to appear in the ftp_div division... It looks something > like this: > > > > Element.update("ftp_div", "<!-- Start FTP List table --> > <table border=\"1\"> > etc... > > with the etc... being replaced by the content that should be showing in > the browser. Any suggestions would be appreciated.Joe, I had the same problem before, and turns out that when you''re using RJS templates you shouldn''t specify the :update on your link_to_remote, so on your case you just call <%= link_to_remote filename, :url => {:action => ''chdir'' , :ftp_dir => filename} %> Hope that helps. -- Thiago Jackiw acts_as_solr => http://acts-as-solr.rubyforge.org -- 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 -~----------~----~----~----~------~----~------~--~---
Unfortunately the problem persists after removing the update tag. Thank you for your help regardless. -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Joe, Joe Smith wrote:> page.replace_html("ftp_div" , :partial => "list_files" , > :object => @list) > > So basically, the user should be able to click on the > directory and the directory listing should be updated > without a page refresh. Instead I get this error when > click on one of the links: > > RJS error: > > TypeError $(element) has no propertiesI think it''s trying to tell you it can''t find a unique DOM element with that id. One thing you might check is to ensure that the tag <div id=''ftp_div''> appears once, and *only* once, in the html page you''re producing. hth, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bill Walton wrote:> Hi Joe, > > Joe Smith wrote: > >> TypeError $(element) has no properties > I think it''s trying to tell you it can''t find a unique DOM element with > that > id. One thing you might check is to ensure that the tag <div > id=''ftp_div''> > appears once, and *only* once, in the html page you''re producing. > > hth, > BillLOL, I made a stupid error. I had <div class="ftp_div"> instead of id="ftp_div". I changed it and all is well. Thank you for your help. -- 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 -~----------~----~----~----~------~----~------~--~---
Joe Smith wrote:> I''m trying to build an WebFTP application in Rails for some practice. > > Here is a link located in a partial named _display_file that is called > by a partial named _list_files. A similar link is created for every > directory in the FTP > > <%= link_to_remote filename , > :url => {:action => ''chdir'' , :ftp_dir => filename}, > :update => ''ftp_div'' %> > > It should, to my understanding, make a call to the ''chdir'' action and > use the results to update the ftp_div. > > The controller action ''chdir'' is shown below: > > def chdir > @ftp = session[''ftp''] > > @ftp.chdir( params[ :ftp_dir ] ) > session[''ftp''] = @ftp > @list = @ftp.list("-a") > end > > btw, I can store the ftp object inside a session because I''ve enabled > memory_cache instead of other session types. So that''s not the issue, > it works without the AJAX. > > Finally the file chdir.rjs is shown below: > > page.replace_html("ftp_div" , :partial => "list_files" , :object => > @list) > > > > So basically, the user should be able to click on the directory and the > directory listing should be updated without a page refresh. Instead I > get this error when click on one of the links: > > > > RJS error: > > TypeError $(element) has no properties > > Afterwords I get a "notice" box containing what appears to be the code > I would like to appear in the ftp_div division... It looks something > like this: > > > > Element.update("ftp_div", "<!-- Start FTP List table --> > <table border=\"1\"> > etc... >In my experience, javascript doesn''t like double quotes (") very much. Maybe try page.replace_html(:ftp_div ... or page.replace_html(''ftp_div''... instead? Regards, Henning --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Joe Smith wrote:> I changed it and all is well. Thank you for your help.Congrats and you''re welcome. Best regards, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---