1

单击按钮传入button=URL:

# example.html.haml
= form_for @contact, html: { method: :get }
  = f.text_field :phone
  = f.button "Call Me!"

如何防止 Rails 传递额外的 URL 参数?

4

1 回答 1

2

添加name: nil到按钮:

= form_for @contact, html: { method: :get }
  = f.text_field :phone
  = f.button "Call Me!", name: nil

来源:如何在 Rails 中禁用提交按钮参数

于 2013-04-17T02:25:50.100 回答