This project is archived and is in readonly mode.

#5671 ✓stale
Aaron Reichman

Prototype UJS driver form events

Reported by Aaron Reichman | September 20th, 2010 @ 05:00 PM

At the end of the default Prototype UJS driver, the following event callback is added to re-enable the form's submit button and toggle any data-disable-with values:


document.on("ajax:after", "form", function(event, element) { ... });

I believe this callback should be based on the "ajax:complete" event instead though. Since "ajax:after" is fired immediately after the form submission, and therefore pretty much immediately after "ajax:before", there is never any time to display the "Saving..." dialogue from the data-disable-with attribute. Likewise, the submit button is immediately toggled back to an enabled state, potentially allowing unintended multiple submissions.

Comments and changes to this ticket

  • Yuval Kordov

    Yuval Kordov September 25th, 2010 @ 12:48 AM

    Thought I'd just add that in my case this event is simply not firing. The input text is correctly replaced with the disable text, but on the completion of the submit, the ajax:after event doesn't get triggered, so my form is left disabled with the disabled text.

  • Yuval Kordov

    Yuval Kordov September 25th, 2010 @ 12:59 AM

    Sorry. Turns out it was being triggered so fast that it appeared as though it wasn't. So essentially, I'm +1ing the original issue. I've attached the restoration of the submit button to ajax:complete instead of ajax:after, as suggested, and everything functions as expected.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • State changed from “open” to “stale”
  • Niels Meersschaert

    Niels Meersschaert February 3rd, 2011 @ 08:27 PM

    • State changed from “stale” to “open”

    [state:open] I have been running into this issue as well. Any disable button immediately returns to it's prior state before the Ajax request has completed. Switching to ajax:complete fixes this for me.

  • rails

    rails May 4th, 2011 @ 01:00 AM

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • rails

    rails May 4th, 2011 @ 01:00 AM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages