Reputation: 3937
Why does this correctly launch the "confirm" dialog...
<%= link_to "Visit Other Site", "http://www.rubyonrails.org/", :confirm => "Are you sure?" %>
...but not this one:
<%= submit_tag "Save", :confirm => "Are you sure?" %>
I'm using:
Upvotes: 1
Views: 1971
Reputation: 176392
The :confirm
option is deprecated, it is now going to be replaced by the data attribute. Internally, the submit_tag
is already doing the replacement.
See the submit_tag
documentation and source code.
Because the data attributes rely on Unobtrusive JavaScript to be executed, you should have included jQuery JS and the Rails UJS file. Otherwise, the attribute will be visible in the source code (please check it) but will not trigger the confirmation.
Upvotes: 1