Nested AJAX remote_form in form?

I’d like to achieve something that is better described by the following
code:

<%= start_form_tag :action => ‘create’ %>
<%= text_area ‘place’, ‘description’, :cols => 100, :rows => 4 %>

<div id="categories">
  <%= form_remote_tag :update => 'categories',
                      :url => { :action => 'add_category' } %>
  <%= text_field_tag 'new_price' %>
  <%= submit_tag 'Add' %>
</div>

<%= submit_tag "Create" %>

<% end_form_tag %>

But I know for sure that this isn’t going to work due to the nested use
of forms. Is there a Rails-way to submit using AJAX while filling a
simple form?

Cheers,
Marco

Marco L. wrote:

  <%= submit_tag 'Add' %>
</div>

<%= submit_tag "Create" %>

<% end_form_tag %>

But I know for sure that this isn’t going to work due to the nested use
of forms. Is there a Rails-way to submit using AJAX while filling a
simple form?

Yes, check out submit_to_remote and link_to_remote, particularly their
:submit options:

http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper.html#M000412


We develop, watch us RoR, in numbers too big to ignore.

form_remote_tag

Michael