Send As SMS
Transcraft Blog
The choice of the IT professionals

Friday, December 09, 2005

Enhancement in Rails remote_function() to support Javascript calls

I have a dropdown list on my web page which is supposed to invoke a remote AJAX call to refresh a portion of the page each time a selection is made. With Ruby on Rails, the recommended way of doing it is to tie the remote_function() call to the onchange() event of the <select> tag. The problem is, with the remote_function() call, the URL you pass to it is static at the point of creation for the dropdown list, so it is impossible to pass the actual selection to the call when it is made, unless you wrap the URL into a Javascript function. However, if you look at the way remote_function() is implemented, there is no support for a Javascript wrapper at all. Well, my improved version and the way I approach solving this problem is here.

posted by David at 10:21 PM


Post a Comment

Links to this post:

Create a Link

<< Home

Contact us

Previous Posts

links to this post

Powered by Blogger