form_for being submitting by 2 links, how to I tell which was used when I am back in the controller?

前端 未结 1 964
清酒与你
清酒与你 2021-01-28 22:08

I putting a form together, but for design reason the form must be submitted by a link. I found out how to perform that:

= link_to_function \"Next >>\", \"$         


        
1条回答
  •  说谎
    说谎 (楼主)
    2021-01-28 22:28

    = link_to_function "Next >>", "$('#hidden_field').value = 1;$(this).up('form').submit()"
    = link_to_function "Next 2 >>", "$('#hidden_field').value = 2;$(this).up('form').submit()"
    

    Assuming you're using jquery, set a hidden field to different values depending on which link was clicked. The 2nd parameter to link_to_function is merely javascript, after all.

    0 讨论(0)
提交回复
热议问题