Forum: Ruby on Rails Nested AJAX remote_form in form?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Marco L. (Guest)
on 2006-04-14 15:58
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
Mark Reginald J. (Guest)
on 2006-04-15 03:51
(Received via mailing list)
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/Help...

--
We develop, watch us RoR, in numbers too big to ignore.
Michael T. (Guest)
on 2006-04-15 17:16
(Received via mailing list)
form_remote_tag

Michael
This topic is locked and can not be replied to.