Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"data-confirm" with form inconsistent #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cjolly
Copy link

@cjolly cjolly commented Jun 8, 2011

prototype-ujs expects that the data-confirm be on the form element rather than the submit button. button_to helper 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.

@pond
Copy link

pond commented Oct 19, 2011

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:

if (button && !allowAction(button)) {
  event.stop();
  return false;
}

...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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants