Forum: Ruby on Rails form_for, partials, and rjs

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
60360c90e1c5254adaeddbd583ce7304?d=identicon&s=25 William Heartwell (bill-h)
on 2006-04-15 14:52
Hi there!
Im trying to use rjs templates to add form fields to an existing form.
So for example a user could fill out a form and optionally hit a
link_to_remote and get another set of identical fields to fill before
sending.  This would mean he/she could add ex. more than one record in
the same form.

The original form was rendered with form_for and using a partial:
<% form_for :example, @example, :url => example_url(:action =>
'create_example') do |f| %>
<%= render :partial => 'shared/forms/example', :locals => {:f => f} %>
<% end %>

And Im having so much fun with form_for that Id like to continue using

But how can I add the partial in a rjs template without adding <form>

I realize that I could get what I wanted if wasn't using form_for with
something like:
page.insert_html :before, 'add_form', :partial => 'shared/forms/example'

and just set the @example variable in my controller.

But I was just wondering if anyone had any ideas for a solution using
This topic is locked and can not be replied to.