Answer by Petros Kyriakou for Rails: Multi-submit buttons in one Form
it can also be done on the form_for helper like this<%= f.submit "Publish",name: "publish", class: "tiny button radius success" %><%= f.submit 'Mark as Draft', name: "draft", class: "tiny...
View ArticleAnswer by yonatan for Rails: Multi-submit buttons in one Form
usually i using the suggestion given by John Topley (see answer above).another way is using JQuery /JS changing the form action attribute- upon clicking the submit buttonexample:form_tag({} ,:method...
View ArticleAnswer by dennismonsewicz for Rails: Multi-submit buttons in one Form
You could also set some data attributes on the submit buttons and use JavaScript to change out the form action on click of one of the buttons
View ArticleAnswer by siliconsenthil for Rails: Multi-submit buttons in one Form
We solved using advanced constraints in rails.The idea is to have the same path (and hence the same named route & action) but with constraints routing to different actions.resources :plan do post...
View ArticleAnswer by John Topley for Rails: Multi-submit buttons in one Form
This was covered in Railscast episode 38. Using the params hash to detect which button was clicked is the correct approach:View:<%= submit_tag 'Create' %><%= submit_tag 'Create and Add...
View ArticleAnswer by Alok Swain for Rails: Multi-submit buttons in one Form
I remember coming across this problem once. You cannot keep two buttons and then call some action based on the params[:commit]. the submit button onclick is going to call the url the form refers to....
View ArticleRails: Multi-submit buttons in one Form
Say I have an Article model, and in the article 'new' view I have two buttons, "Publish" and "Save Draft".My question is how can I know which button is clicked in the controller.I already have a...
View Article