We have a profile copy enabled, going from Billing to a Shipping profile in checkout. Every once and a while, we get an order with no shipping address. Just found out why.
If you check "Copy Billing Information" and then quickly hit "Continue", you get an ajax error.
An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /system/ajax
StatusText:
ResponseText:
ReadyState: 4
If you close out the ajax error and press "Continue" again, it allows you to go on your merry way without filling in any of the Shipping profile.
So I wonder if there is a way to disable the continue button while other AJAX requests are happening on the same form?
Comments
Comment #1
rszrama commentedHonestly, it's just the nature of the beast w/ respect to the AJAX implementation in Forms API. You can see the same AJAX error clicking the submit button quickly on api.d.o while it's still trying to pull up autocomplete results. We should be able to disable the continue button on update and then re-enable it using an AJAX command, but it's something we'll just have to do on a module-by-module basis.
Let's make this a broader issue and spawn child issues as necessary (for example, shipping rate recalculation in Commerce Shipping).
Places in Commerce core that we should look into for this treatment would include customer profile copying and payment details reloading. I'm not sure we'd need to worry about the address field widget rebuilding, as if it got interrupted you'd still have required elements on the form that would have to have been filled out. The Add to Cart form has AJAX refreshing, but I'd think that any required form elements would come from the line item being used for the Add to Cart form, so at least in the core functionality they shouldn't be changing even when attributes are changed.
Comment #2
tripper54 commentedI have added a child issue in the Commerce Shipping queue - https://drupal.org/node/2043597 .
I'm not sure about protocol here - hope I've done the right thing!
Comment #3
davidwhthomas commentedWe've had similar issues recently for an online clothing store.
The customer selects a different product attribute (size) e.g "Small" and clicks the "Add to cart" button before the "Add to cart" form has refreshed.
The result is the default size (e.g "Medium" is added to the cart, because the product hadn't loaded yet, which has caused some confusion.
Is there anything existing to disable "Add to cart" button while the product attributes are refreshing the product there?
If not can repurpose the JS on the checkout buttons if so any pointers on how to tie in the button disable with the add to cart form ajax refresh?
Thanks.
Comment #4
Andrew211 commentedYeah I had the same thing, I just disabled the submit buttons using js, then when the new form loads the buttons are enabled again.
Something like:
You'd have to have an event listener on the select form elements which on change would trigger the above code.