Working with ajax on a rails 3.1 app, i need to be able to submit an ajax form (with remote: true) using a link rather than a submit button.
what do i need to do to the
When you create a form with :remote => true
the Ajax event is bound to the submit button of the form. You must use javascript to trigger that event. Here is some code I used to accomplish something similar:
<%= form_for [item.list, item], :remote => true, :html => { :'data-type' => 'json', :id => 'change-completed-form' } do |f| %>
<td><%= f.label :name, item.name %></td>
<td><%= f.check_box :completed, :onClick => "this.form.submit_button.click();" %></td>
<%= f.submit :id => 'submit_button', :style => 'display: none;' %>
<% end %>