Show DIV from controller

Use 'render :update' in your controller action:

  render :update do |page|     # manipulate page here   end

Without seeing your code I am just guessing here, but make sure your link_to_remote (or other remote call) does not contain the :update => some_id option. If it does, the rjs won’t be executed by the browser.

-Bill

comopasta Gr wrote:

That won't work because the form is being submitted through a standard post rather than an xhr call. Take a look at the api docs for form_remote_tag at http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000535.

-Bill

comopasta Gr wrote:

In your controller, if your object is not valid, just render the action again. In the view, add an if around the div or set a variable equal to ‘hidden’ or ‘visible’ and use it directly in your style tag. That would only display the div if there are errors. Slightly dirty, but it will work.

-Bill

comopasta Gr wrote:

Check out the blog post at CodeFU: http://khamsouk.souvanlasy.com/2007/5/1/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent

I've tried a few plugins to do ajax-like file upload but this simple, clean approach has been the best so far.