Ruby on Rails : how to implement Cancel button in form_tag

后端 未结 4 1277
情书的邮戳
情书的邮戳 2021-02-07 15:28

I have a basic form using the form_tag helper working fine, but I want to add a cancel button, what is the syntax for doing this? I want the cancel button to appear as a button

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-07 15:38

    If you mean a reset button, paste the following inside your form:

    <%= button_tag "Reset", type: :reset %>
    

    Tested it, it works fine and resets all fields in the form.

提交回复
热议问题