0

In proj.html.erb file, I have code like below which has no disable feature, but in browser, it is disabled. I am wondering why? I haven't set it in anywhere, there is also other buttons in the same container that works fine.

In proj.html.erb:

<div class="sub-div" >
    <%= button_to "Download file", download_path(format: :csv ), class: "btn btn-primary btn-sm", id: "download_btn", :method => :get %>
</div>

When check in browser:

<div class="sub-div" >
  <form class="button_to" method="get" action="">
         <input id="download_btn" class="btn btn-primary btn-sm" type="submit" disabled="disabled">
  </form>
</div>
Dong Jin
  • 21
  • 4
  • This is odd, your code seems fine. Try to check if any javascript code disabling something similar. Or if the view has any unclosed tags. If you can post all your view to compare with the buttons that are working – lestra Aug 16 '22 at 02:18
  • Javascript or the browser itself could be disabling the button. From the code you posted, Rails isn't doing it. https://apidock.com/rails/v5.2.3/ActionView/Helpers/UrlHelper/button_to – Chiperific Aug 16 '22 at 13:15
  • Yea, seems the browser disable the button itself, anyway to solve this? I haven't seen any js code work on this. @Chiperific@lestra – Dong Jin Aug 16 '22 at 17:19
  • Currently, just add some code to enable it, but still wondering why it is disabled. Thanks for anyone giving any clue. – Dong Jin Aug 16 '22 at 18:24
  • I am finding no good search results for a browser adding a disabled tag to a button. Could it be an extension or app attached to your browser? – Chiperific Aug 16 '22 at 19:56

0 Answers0