Form_for, partials, and rjs

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
it.

But how can I add the partial in a rjs template without adding
etc.

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
form_for.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs