This project is archived and is in readonly mode.
Patch that adds an exception
-
Jeff
- Tag changed from action_view, javascript, link_to to action_view, javascript, link_to
I can't speak to what the intention is here, but if you look at the documentation for the link_to_function method, you'll one example of what you're trying to do
link_to_function(image_tag("delete"), "if (confirm('Really?')) do_delete()")http://api.rubyonrails.org/class...
Maybe raising an exception or a warning would be a good idea, but I'm not sure that wrapping the onclick in the confirm is obvious.
-
nasmorn
- Tag changed from action_view, javascript, link_to to action_view, javascript, link_to, patch
- Title changed from :confirm overwrites :onclick to Patch that adds an exception
I hope this is acceptable, it does pretty much what the other exception does
-
Ryan Bigg
- State changed from new to incomplete
- Importance changed from to Low
Please add tests to this patch.
-
Ryan Bigg
- Tag changed from action_view, javascript, link_to, patch to action_view, needs_tests
-
Ben Mills
- Assigned user set to Ryan Bigg
In Rails master seems to do just what it should. Rails 3 utilizes the HTML5 attribute data-confirm to handle the confirmation.
<%= link_to 'bla', '#', {:onclick => "document.merge_form.submit()", :confirm => "Really?"}%>Outputs:
<a href="#" data-confirm="Really?" onclick="document.merge_form.submit()">bla</a>Since it seems unnecessary, my vote:
-1
-
Ryan Bigg
Automatic cleanup of spam.
-
Jeff Kreeftmeijer
Automatic cleanup of spam.
-
Piotr Sarnacki
- State changed from incomplete to invalid
I'm closing that. As Ben noticed, 3.x is no longer adding stuff to onclick attribute.
