Test ftp connection from web form


I'm trying to figure out the best method to test an ftp connection from a web form.

For example,

There is a web form with fields for ftp_host, ftp_username, ftp_password. I created a controller action 'ftp_connection_test' where I grab the current users saved ftp information, try to connect, run a directory listing command and return the success or error message in flash. This seems to be working fine on my 'user settings' pages.

What I'm trying to figure out how to do is:

Run this same action on a sign-up form to test the ftp connection before the fields actually get saved.

Would it be best to do this with RJS? It would be neat if I could automatically run the ftp connection test once all the ftp fields are filled out.

Thanks for any suggestions