Hello,
I have a strange problem when clicking the "Submit" button on the checkout page. Once clicked, the submit method is called again and again (by the callback of paymill.createToken). This results in a blocking browser (Firefox, Chrome, IE), which recursivly calls createToken. It seems that "submitForm.once" does not prevent the event handler to be called only once.
I am using jQuery 1.7, and I cannot find any API specs about "once". I can only find the "one" method, which prevents an event handler to be called multiple times. If I change the line to
submitForm.one('submit', function(e) { ...
then it works. In addition, the lines
if ($('#uc-paymill-token').val() != '' || $('#uc-paymill-errors').val() != '') {
return true;
}
can be removed, because they should never be called if the event handler is only called once.
Best regards,
Stefan
Comments
Comment #1
aramboyajyan CreditAttribution: aramboyajyan commentedHello Stefan,
The
.once()
method is made available through the jQuery Once plugin shipped with Drupal. The file is located atmisc/jquery.once.js
.I haven't tested thoroughly the module with jQuery Update, but a quick test worked for me properly without any blocking issues.
Can you post more information about your setup? Did you try using the module on a clean install?
Thanks.
Comment #2
aramboyajyan CreditAttribution: aramboyajyan commentedComment #3
Stefan Werner CreditAttribution: Stefan Werner commentedHello,
thank you for the information.
I've done more test. When I use jQuery update with jQuery 1.5, everything works, but when I use jQuery 1.7 or higher, then paymill.createToken is called multiple times.
Best regards,
Stefan
Comment #4
aramboyajyan CreditAttribution: aramboyajyan commentedThanks for confirming - I will test the module with jQuery 1.7+ then and see if there are any workarounds for
.once()
method.This is most likely a conflict between that library included in the core and newer versions of jQuery.
Comment #5
aramboyajyan CreditAttribution: aramboyajyan commentedHi Stefan,
I checked this in and out with jQuery update and neither
.once()
nor.one()
work properly with jQuery v1.7+.They call approximately 4 times the submit function on my end, but they do not block the browser. I tested this on Chrome/Firefox/Safari on Mavericks. The module still works on my end and I think there should be no issues as it will use just one of the tokens to process the payment.
However, I'll investigate this more and provide a fix as soon as I come to a solution.
I found few posts saying that jQuery update broke the
.once()
method for them as well, so this might be an issue with core scripts.Will keep this thread posted.
Comment #6
aramboyajyan CreditAttribution: aramboyajyan commentedUpdating the status. Will look further into the core issue or provide a workaround so this issue can be closed as well.
Comment #7
markdcHi Stefan, I also use jQuery 1.7 for a site and experienced this recursive behavior on Checkout. I made your suggested changes to the code, but checkout now gives me a white screen. Any idea what may be causing that?
And is anyone using this Paymill module successfully? I can't find a better CC gateway for clients in Germany, so I'd love to get this working.
Comment #8
aramboyajyan CreditAttribution: aramboyajyan commentedHi Mark, I'm the maintainer of the module. It hasn't received an update for some time as we didn't end up using it on our sites + there were very little sites needing Ubercart + Paymill combo.
Could you provide some more information on the white screen? Is there anything in the logs?
Comment #9
markdcThe logs are empty. I had trouble getting the PHP library provided on this project page to be detected. It returns as Not Installed in the Status Report. So I downloaded the 4.4.0 version from GitHub. It was detected as version 3.2.1. I'm wondering if that's the cause.
Comment #10
aramboyajyan CreditAttribution: aramboyajyan commentedPossible; I haven't looked in Paymill PHP library for quite some time and it must have been updated at some point.
Will check this issue out and keep you posted.