Generating a form using form_tag/remote_form_tag in an RJS template?

Is there a way to use the form_tag/remote_form_tag helpers in an RJS
template? I want to replace the innerHTML of a div with a remote form
as the result of an AJAX request and I’m not having any luck getting
it to work. I’m trying something like this:

page.replace_html “delete_div”, form_tag(:url=>"/listings") do
submit_tag “Delete” end

but that doesn’t work very well. The element is generated but
the block seems to be ignored. I’ve tried a million other variations
and can’t get them to work either. Any way to use these helpers in an
RJS template? If not, how else can I do what I’m trying to do?

Thanks in advance.

put the stuff in a partial and render that:

page.replace_html “delete_div”, :partial => “my_form”

Thanks, that seemed to do the trick, although I’m not clear on why the
partial is required for this to work. Oh well…

On Dec 21, 1:51 am, Thorsten M. <rails-mailing-l…@andreas-