Whenever there are more available Payment Methods then Square Connect only, and Square Connect is selected, and then another Payment Method is selected, pressing on the 'Continue to next step' button throws a Javascript error and the next screen is never reached.

Javascript Error thrown:

TypeError: this.iframeControllers.cardNumber.element.contentWindow is null

Marked as Major, since there's no visible error (except in the browser console) and the user is endlessly waiting on the next screen.

Comments

Spokje created an issue. See original summary.

spokje’s picture

Attached patch checks if the selected payment method is Square Connect before "hijacking" the submit-button.

spokje’s picture

Assigned: spokje » Unassigned
Status: Active » Needs review
czigor’s picture

We should unbind the click event in detach instead.

Status: Needs review » Needs work
spokje’s picture

Patch #4 is against 8.x.1.x as it seems

spokje’s picture

StatusFileSize
new1.87 KB

Reworked Patch #6 for version 7.x-1.x

spokje’s picture

@czigor: Couldn't get the $formSubmit.off('click.squareNonce'); and $formSubmit.on('click.squareNonce'); working on the $squareForm. It had to be $rootForm.

Not sure if this is any different in the 8.x-1.x version

spokje’s picture

Status: Needs work » Needs review
spokje’s picture

StatusFileSize
new1.53 KB

Patch #7 added the click event by mistake to the "Go back"-button as well.
Fixed in this patch

  • czigor committed 8bad21c on 8.x-1.x
    Issue #2927616 by Spokje, czigor: When multiple Payment methods are...
czigor’s picture

@Spokje
In 8.x $submitForm is already the form element, that's why I removed $rootForm.
Also, "Go back" in 8.x is just a link, not a button.

Committed #4 to 8.x, so that we can focus on 7.x here.

czigor’s picture

StatusFileSize
new1.5 KB
new905 bytes

Just a small performance fix: We don't need closes('form') on $form, it's already the form element.

Also removed some trailing whitespaces.

@Spokje Can you please test it?

czigor’s picture

StatusFileSize
new1.49 KB
new463 bytes

Removing one more closest().

spokje’s picture

Status: Needs review » Reviewed & tested by the community

Was just about to remove the comment on the remaining closest(), but you beat me to it.

Tested #14 and it works for me, so RTBC.

czigor’s picture

Status: Reviewed & tested by the community » Needs work

jQuery.on() was only added in 1.7, drupal 7 ships with 1.4.4.

czigor’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new2.91 KB
new1.33 KB

Adding jquery_update as dependency.

  • czigor committed 3a0f8b1 on 7.x-1.x authored by Spokje
    Issue #2927616 by czigor, Spokje: When multiple Payment methods are...
czigor’s picture

Status: Needs review » Fixed

Committed, thanks!

mglaman’s picture

Woah wait, we introduced a dependency in the 7.x branch for jquery_update? Why can't we use bind versus on?

  • mglaman committed f734a69 on 7.x-1.x
    Revert "Issue #2927616 by czigor, Spokje: When multiple Payment methods...
mglaman’s picture

Status: Fixed » Needs review
StatusFileSize
new1.49 KB

Talked with czigor. To ease module maintenance and not add a dependency, let us just use bind and unbind.

Patch attached. I have not tested it yet. But it is the patch in #14 just with on/off replaced. Review/test appreciated!

czigor’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good and also works for me.

spokje’s picture

Same here in production environment: New patch works without need for jQuery update module.

  • mglaman committed 5b89e4c on 7.x-1.x authored by Spokje
    Issue #2927616 by czigor, Spokje, mglaman: When multiple Payment methods...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! I'm looking to tag a new release today or this week which will include this fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.