Problem/Motivation

After upgrading my drupal site from 8 to 9 the autocomplete is no longer functioning. I am seeing the wheel but it is inactive and the only errors I see in the inspector are the following:

Uncaught TypeError: value.autocomplete is not a function
at HTMLInputElement. (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:5644)
at Function.each (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:2)
at Object.attach (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:5623)
at js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:246
at Array.forEach ()
at Object.Drupal.attachBehaviors (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:243)
at js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:472
at HTMLDocument.listener (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:460)

Uncaught TypeError: $(...).find(...).removeOnce(...).autocomplete is not a function
at Object.detach (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:5658)
at js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:262
at Array.forEach ()
at Object.Drupal.detachBehaviors (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:259)
at Drupal.AjaxCommands.insert (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:2769)
at js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:2672
at Array.forEach ()
at Drupal.Ajax.success (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:2670)
at HTMLScriptElement.bigPipeProcessPlaceholderReplacement (js_dd8Xn-tijGpG2i8L9FP9lRlkb5S3paCCNkT1Tjz0vNg.js:1955)
at Function.each (js_xfbyUFlOTt9DOMyK4rP2oNCgfeUfq5R_JFd79ULEa54.js:2)

I attempted to remove the module and reinstall but I am still getting the same error, is anyone else having this issue?
Thanks.

Comments

lanzone created an issue. See original summary.

gigimaor’s picture

Since jQuery UI has deprecated from Drupal I suggest a quick fix:
Generate a custom jQuery UI JS file that include the autocomplete widget in the next link. (https://jqueryui.com/download/#!version=1.12.1&components=11111111111100...)

Save the file in your theme/js folder and add it path to your theme libraries.

Its not a proper Drupal solution but it do the work.

lanzone’s picture

Awesome thanks for the solution, for the moment that seems to have worked appreciate the help and effort.

drdam’s picture

drunken monkey’s picture

Priority: Critical » Normal

Not sure where this is coming from. It’s working fine for me, and I’m always on the latest Drupal version (give or take a few weeks) for development. Automated tests have also been running fine with Drupal 9 for more than a year now.

Could you deactivate JS aggregation temporarily to get a more useful error message?
Also, could there be any custom or third-party JS files interfering? In search_api_autocomplete.js we don’t ever call any .autocomplete() method, so I’m a bit sceptical whether this really is a problem in this module.

drunken monkey’s picture

Status: Active » Postponed (maintainer needs more info)
marcoka’s picture

I think this is the same error as here, different module.
#3220334: value.autocomplete is not a function
It is about this it seems #3156376: jQuery UI library definitions have been deprecated

drunken monkey’s picture

I still can’t reproduce this, don’t know how to fix it and no-one has provided a helpful backtrace. Could someone please at least post a backtrace for the error without JS aggregation enabled?

marcoka’s picture

Sorry didn´t check for reproduce. Just remembered the same error. I also can not reproduce that error with the latest version.

yogi gurjar’s picture

I was getting this uncaught type error autocomplete is not a function in laravel while creating autocomplete in laravel.

Include jQuery UI css and Js on your web page where you have to develop autocomplete search functionality.

I found this guide helpful for this error: https://www.tutsmake.com/laravel-jquery-ui-autocomplete-ajax-search-example/