Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In the Checkout screen, I can Cancel or Submit my payment.
When I click on Submit, the Cancel button gets disabled but not the submit button.
I think that both should be disabled or hidden and maybe even a message shown in their place saying "Purchase submitted... Please wait." That way we'd avoid people clicking 20 times on the button (which I'd bet happens.)
I can see the function in the cart.js file but I don't understand how $(this) is set properly.
Thank you.
Alexis
Comment | File | Size | Author |
---|---|---|---|
#8 | 795676-cart-jquery.patch | 1.01 KB | longwave |
#5 | SubmitOrderNotGreyedOut.png | 21.62 KB | AlexisWilke |
Comments
Comment #1
maximpodorov CreditAttribution: maximpodorov commentedYes, it's really annoying, and can create problems. For me, a strange problem appears in uc_discounts_alt module after doubleclicking on 'Submit order' button. The following modification fixes the problem. Now the original button is really hidden, and the only visible button is disabled clone.
Comment #2
TR CreditAttribution: TR commented@AlexisWilkie: I don't see that the Cancel button ever gets disabled on the checkout page, and I don't see any code that would do that. Maybe this is browser-controlled (and therefore browser-dependent) behavior? I'm using Firefox. Also, there's no "Submit" button on the checkout page, it's "Review order". This is significant because the action isn't finalizing an order, so double clicking really doesn't cause a problem here.
@maximpodorov: Your situation is different than the original poster - the OP was talking about the checkout page while you're talking about the checkout review page. There is no Cancel button on the checkout review page. Moving the .hide() to a new line like you have done doesn't change the behavior of the JavaScript, at least in the version of jQuery that comes bundled with Drupal 6. .end() unwinds the stack, so .hide() is applied to the original $(this) wrapped set in both the current version of the uc_cart.js and in your modified version. Are you perhaps using jQuery update or a new version of the jQuery libraries? Perhaps something that has changed in the jQuery library.
Comment #3
maximpodorov CreditAttribution: maximpodorov commentedYes, I use jQuery Update module (with jQuery 1.3.2), and the problem (on checkout review page, you're right) does exist.
Comment #4
AlexisWilke CreditAttribution: AlexisWilke commentedTR,
Well... I guess I meant the Review screen. The one with two buttons. I use SeaMonkey and FireFox and also I tested on IE. I get the same behavior on all 3.
Now, there is another problem too, all the other links on the page remain click-able. So I was thinking that an even better way would be to show an overlay that's transparent and that prevents clicks anywhere. That way the buttons cannot be clicked and all the links cannot be clicked. (in my website design, removing all the menus would look... quite broken!)
That overlay could include a sentence defined by the admin saying that the transaction is being processed, please wait...
I did not yet test Maxim's changes.
Thank you.
Alexis
Comment #5
AlexisWilke CreditAttribution: AlexisWilke commentedThere is a sample in a PNG. As you can see I clicked on the Submit button. The Back button is grayed out but the Submit button is still clickable. The waiting GIF shows up but I'm sure some people still click the button multiple times.
Thank you.
Alexis
Comment #6
smartparty CreditAttribution: smartparty commentedHaving exactly same issue with jquery update (jq 1.3.2) where back/cancel button is greyed out, but the submit button is not.
This is allowing duplicate credit card transactions too with the protx/sagepay module.
** Update: Can confirm code in comment #1 works for me **
P.
Comment #7
maximpodorov CreditAttribution: maximpodorov commentedThis is better (end() is removed):
Comment #8
longwavePatch format attached.
When the Ubercart maintainers look at this, I also request that they consider #941546: uc_cart.js contains unreachable code at the same time.
Comment #9
longwaveFixing title.
Comment #10
longwaveMarking RTBC as smartparty already confirmed this patch works.
Comment #11
AlexisWilke CreditAttribution: AlexisWilke commentedHmmm... So we hide the Submit button and disable the Back button. Should we not hide or disable both instead?
should probably also become .hide():
What do you think?
Thank you.
Alexis
Comment #12
longwaveThe submit button is cloned, the clone is disabled and the original is hidden; this means the click processing on the original button occurs as normal. The back button is simply disabled, so the net effect to the end user is that both buttons appear disabled.
Comment #13
smartparty CreditAttribution: smartparty commentedI've applied the latest patch and still see two throbbers instead of one when the submit button is clicked.
P
Comment #14
sammys CreditAttribution: sammys commentedThose testing need to make sure they aren't using uc_optional_checkout_review module because this patch won't fix the submit button you get using that module.
I've patched the uc_optional_checkout_review.js file with the same fix (#8) and it works for that as well. I'd say the patch is RTBC.
I have a feeling jQuery 1.2 changed the way chaining works with a cloned jQuery object. It looks like the end() call actually returns the chain to the clone and not to the original object ($(this) in the case of this bug).
Comment #15
AlexisWilke CreditAttribution: AlexisWilke commentedsammys,
That wouldn't work because we're not supposed to know that this other module is there. However, this may required a JavaScript hook... I'm not aware of any specific Drupal API for such a case.
Thank you.
Alexis
Comment #16
longwaveIf uc_optional_checkout_review is buggy, it is not uc_cart's responsibility to fix this - a patch should be posted at http://www.ubercart.org/node/4987
Comment #17
sammys CreditAttribution: sammys commented@AlexisWilke,
In my post above I'm warning testers of this patch that if they have uc_optional_checkout_review installed the posted patch will not fix their problem. I have absolutely no idea what you are talking about.
I think patch #8 will fix the bug reported by the OP because I tested the fix on uc_optional_checkout_review's JS and that worked. They are copies of the same code. Thus a patch for uc_optional_checkout_review can be created by anyone that cares to fix that module also. Good stuff huh? RTBC yo!
Comment #18
Island Usurper CreditAttribution: Island Usurper commentedCommitted. I'm glad that Drupal 6 now ships with jQuery 1.2 so we don't have to worry about whether jquery_update is enabled or not.
Comment #19
longwaveNeeds porting to 7.x.
Comment #20
longwaveWait, no it doesn't :)