Rails, how do you submit a form with a text link?

后端 未结 4 700
一整个雨季
一整个雨季 2021-02-09 14:49

I am trying to get this form to submit correctly. Here\'s what I have so far:

<% form_for(:user, :url => update_user_setting_path, :remote => true, :htm         


        
4条回答
  •  一向
    一向 (楼主)
    2021-02-09 15:31

    You don't need to use an id or a selector if you have jquery, you can simply do :

    = link_to 'Save', "#", onclick: "$(this).closest('form').submit()"
    

提交回复
热议问题