Reputation: 213
I need to create a button for downloading So far I have create a button using this
<%= form_tag '/myproject/download', :multipart => true, :onclick=>"document.getElementById('popup').style.display='block'; return true;" %>
<%= submit_tag 'Download'%> <% end %>
but I don"t know how to link the submit_tag with the link of downloading. (so as simple as if I press the button, then it will go to localhost/file and pop up a save to option) I am aware that I can use link_to, but I need to put a button that acts as a link_to
Can anyone point out how to do this in rails? thank you
Upvotes: 0
Views: 2243
Reputation: 10422
Try to use the button_to method. You can take a look to the docs.
Upvotes: 0
Reputation: 2984
Try button_to
method, which is nearly identical to link_to
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-button_to
Upvotes: 0
Reputation: 635
You can put a link_to and then style it like a button. Or you can do something like this Is there a way with rails form helper to produce a button tag for submit
Upvotes: 0