devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

JS error from incorrect code sample

Open baoutch opened this issue 3 years ago • 3 comments

General issue

The tutorial described in this doc results in a JS error

https://devdocs.magento.com/guides/v2.4/howdoi/checkout/checkout_form.html

Description:

Followed the 3 steps of the tutorial to add new form to checkout

Form correctly displayed in Checkout / Shipping step

Clicking on the "Submit" button results in the following error :

 Uncaught TypeError: this.source is undefined
    onSubmit .../Vendor/default/fr_FR/Vendor_Module/js/view/custom-checkout-form.js:22
    init .../Vendor/default/fr_FR/knockoutjs/knockout.js:4669
    jQuery 6

Possible solutions:

Add in config <item name="provider" xsi:type="string">checkoutProvider</item>

As in

<item name="config" xsi:type="array">
    <item name="provider" xsi:type="string">checkoutProvider</item>
    <!-- And this to add your html template  -->
    <item name="template" xsi:type="string">Vendor_Checkout/custom-checkout-form</item>
</item>

baoutch avatar Dec 09 '21 16:12 baoutch

Hi @baoutch. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Dec 09 '21 16:12 m2-assistant[bot]

Dupe or related to https://github.com/magento/devdocs/issues/9287

dobooth avatar Dec 15 '21 19:12 dobooth

@dobooth the issue was fixed in the pull request https://github.com/magento/devdocs/pull/9298

TuVanDev avatar Jan 06 '22 13:01 TuVanDev