rails multiple form actions with ajax
I have a basic Rails form like so:
<%= form_for @person do |f| %>
<%= f.label :first_name %>:
<%= f.text_field :first_name %><br />
<%= f.label :last_name %>:
<%= f.text_field :last_name %><br />
<%= f.submit %>
<% end %>
How could I optionally send the form information to another an entirely different controller via ajax?... two buttons (bypassing the main controller) The reason being... the user could make the booking... or simply include the same information to a inquiry form which doesn't touch the booking controller/model.
Bas开发者_如何学Cically I want all the form objects, but just sent to another controller?
Something like link_to_remote + all my form contents.
I think what you need is form with two buttons. like one button is for booking and another is inquiry. if that's case then try following link it explains well ..
Two submit buttons with form_remote_tag
精彩评论