我试图使用link_to提交一个表单,代码如下:
<%= form_for(@post, :url=> '/post/action', :method=> 'post', :html => {:id=>'form_id'} ) do |f| %>
....
<%= link_to 'submit', "/post/action", :onclick=>"document.getElementById('form_id').submit()" %>
....
但它并未提交表单,而只是将我的表单重定向到指定的URL。有没有人知道如何解决这个问题?