[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RJS/link_to_remote

Joe Smith

12/5/2006 7:34:00 PM

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-....

1 Answer

Joe Smith

12/5/2006 7:36:00 PM

0

Sorry, I thought I submitted this in the "Rails" forum. I'll post it
there now.

--
Posted via http://www.ruby-....