The form will not submit when "New credit card" has been selected and then deselected.
User scenario / steps to reproduce: User fills out payment form, goes to review page. User then chooses to edit Payment Information, is taken back to previous page. If the user now selects New credit card, and then without filling out the form selects the previously entered card instead, the form can no longer be submitted. Attempts to click on the submit button will fail silently.
Cause:
The issue seems to be that square's JS is attempting to validate fields in iframes which no longer exist on the page.
JS console output:
Uncaught TypeError: Cannot read property 'postMessage' of null
at n.blurAllInputs (paymentform:1)
and
Uncaught TypeError: Cannot read property 'postMessage' of null
at n.setPostalCode (paymentform:1)
at n.setPostalCode (paymentform:1)
at HTMLButtonElement.requestCardNonce (eval at globalEval (jquery.min.js?v=2.2.4:2), <anonymous>:158:19)
at HTMLButtonElement.dispatch (jquery.min.js?v=2.2.4:3)
at HTMLButtonElement.r.handle (jquery.min.js?v=2.2.4:3)
Comment | File | Size | Author |
---|---|---|---|
#3 | form_submit_broken_when-2903013-3.patch | 2.04 KB | mglaman |
|
Comments
Comment #2
mglamanThis is also happening with AJAX from shipping. I believe there is a fix we can borrow from Braintree.
Comment #3
mglamanProposed patch, based off of Braintree
Comment #4
mglamanThis fixed our demo store and I'm able to complete check out in our automated Behat test. Will commit and tag new beta
Comment #6
mglamanComment #7
collin.rickford CreditAttribution: collin.rickford commentedI'm still seeing the issue on the latest beta - will test on a vanilla commerce install and report back.
Comment #8
mglamancollin.rickford, shoot. Thanks. Let me know. I know this fixed my automated testing when using Shipping and AJAX calculation of shipping methods. I'll help review other AJAX as well when time allows. Let me know.