Replace_html and render action?

Hey,

is it possible to use replace_html together with a render :action?

This is my code:
render :update do |page|
page.replace_html ‘contentBody’, render(:action => ‘new’)
end

and this is the confusing result in my contentBody:
try {
Element.update(“contentBody”, “”);
} catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert(‘Element.update(“contentBody”, “”);’
); throw e }

Why doesn’t it work? Is there any alternative? It’s a bit tricky
because:

  • I can’t redirect_to because I need the content in ‘contentBody’
  • I can’t render :action cause it wouldn’t know where to put the content
    (coming from a form_remote_tag)
  • I can’t use partials cause I need to use normal views

Anyone any idea? Thanks in advance!

So from the view where you called this def you might have used
link_to_remote or some thing like that…isn’t it? So add
:update => “contentBody” to that

Now in action just write

render :action => ‘new’

Sijo

Yep, I just figured out that :update was missing right after I posted
that, thanks :slight_smile: