Conversation
…form so confirm dialogs work with button_to
|
Bit of a shame to find this pull request from months ago. I encountered exactly the same issue - basically, prototype-ujs at the time of writing is not entirely compatible with the documented Rails v3.1.1 API and legacy applications may fail to work properly as a result (mine certainly did). It's very difficult to find with automated tests too, since it's a user interface level JavaScript interaction fault. My solution was to duplicate the allowAction() check from the "submit" handler into the "click" handler - something like: ...before the "event.findElement" call. Either way this really needs fixing - people are submitting patches; why are these not being included? I'd love to see this merged in ASAP. I'm not interested in the latest fad or flame war about jQuery vs Prototype; I'm interested in using Prototype on Rails 3 so I can upgrade a legacy application without having to rewrite every line of JS code to deal with a different library. It's not rapid application development if I have to keep rewriting the same application over and over :-) |
prototype-ujs expects that the
data-confirmbe on the form element rather than the submit button.button_tohelper in rails adds it to the submit input. As well, I believe the jquery-ujs driver expects the attribute on the submit input.I don't think my fix is an end all as it's pretty flawed (if you have existing forms with data-confirm) but may work as a quick fix for folks running into this. Anyway, a heads up on the issue.