magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Cannot read property 'autocomplete' of undefined

Open snez opened this issue 9 years ago • 11 comments

Preconditions

  1. Magento 2.1.4
  2. PHP 7.0.14
  3. MySQL 5.6.22
  4. Google Chrome 56.0.2924.87 (Official Build) (64-bit)

Steps to reproduce

  1. Add two products to the shopping cart
  2. Navigate to the shopping cart page at /checkout/cart/
  3. Click "Checkout with multiple addresses"
  4. Follow the steps

Expected result

  1. No javascript crashes
  2. No interference with Payment Methods

Actual result

  1. Javascript crash
  2. Payment Methods do not appear

screen shot 2017-02-13 at 15 28 33

snez avatar Feb 13 '17 15:02 snez

I have exact same errors on any page. Magento version 2.1.4 and earlier.

Ctucker9233 avatar Mar 24 '17 18:03 Ctucker9233

@snez Workaround found here http://magento.stackexchange.com/questions/125034/js-errors-magento-2 seems to work.

Ctucker9233 avatar Mar 24 '17 19:03 Ctucker9233

I am using magento version 2.1.6 and also getting the same error.

govindarajprevaj avatar Apr 25 '17 13:04 govindarajprevaj

Hi, @snez. Thanks for reporting this issue. We've created internal ticket MAGETWO-70389 to address this issue.

dmitriyprime avatar Jun 30 '17 14:06 dmitriyprime

For what it is worth, I think I have tracked this down as the route cause (a long with https://github.com/magento/magento2/issues/6983) for some issues around gift message fields in basket not loading as the jQuery has an error. This doesn't explain why other elements do work - but fixing this solved the issue after a considerable amount of time looking in to it.

timbaker1991 avatar Jul 17 '17 18:07 timbaker1991

I am also having this issue, does anyone know of a work around? Thanks.

mattgreenfield avatar Jul 24 '17 08:07 mattgreenfield

Still present in 2.1.8; https://github.com/magento/magento2/blob/2.1.8/app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js

Appears fixed (or at least changed) in 2.2RC; https://github.com/magento/magento2/blob/2.2.0-rc3.0/app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js#L23

peterjaap avatar Sep 14 '17 10:09 peterjaap

@snez, thank you for your report. The issue is already fixed in develop branch, 2.2.0

magento-engcom-team avatar Oct 04 '17 18:10 magento-engcom-team

I started having 'autocomplete' of undefined exact same as @snez described when I was asked to by my team to remove shopping cart icon completely so I did in my custom theme I added:

<referenceBlock name="top.links">
     <referenceBlock name="minicart" remove="true" />
</referenceBlock> 

Didn't see the undefined until I had to look at the chrome console for debugs I got a surprise and spend a few hours trying to figure it out what was causing the issue then gotcha! now I am just using css to display:none . ref: Magento 2.1.7

lano-vargas avatar Dec 04 '17 14:12 lano-vargas

https://magento.stackexchange.com/questions/125034/js-errors-magento-2

This will work Copy file from vendor/magento/module-customer/view/frontend/web/js/view/authentication-popup.js to app/design/frontend/<custom_theme_name>/<custom_theme>/Magento_Customer/web/js/view/authentication-popup.js

and replace the below code from autocomplete: window.checkout.autocomplete to autocomplete: ((window.checkout && window.checkout.autocomplete) ? window.checkout.autocomplete : null),

Line No : 26

Please run bin/magento setup:static-content:deploy command.

Hope this will work for you

aimscoder avatar Dec 08 '17 04:12 aimscoder

In addition to the update from @aimscoder, I had to include the following in the same file.

login: function (formUiElement, event) {
            var loginData = {},
                formElement = $(event.currentTarget),
                formDataArray = formElement.serializeArray();

becomes

login: function (formUiElement, event) {
            if(!event){
                event = window.event;
            }
            var loginData = {},
                formElement = $(event.currentTarget),
                formDataArray = formElement.serializeArray();

nshiff avatar Feb 13 '18 21:02 nshiff