Uncaught TypeError: select.oldChosen is not a function

Created on 19 March 2023, almost 2 years ago
Updated 3 August 2024, 5 months ago

I'm not too hot at Javascript
Was surprised to find this error in my page
Uncaught TypeError: select.oldChosen is not a function

from chosen.js:24
var ret = select.oldChosen(options);
Composer believes everything is up to date.

💬 Support request
Status

Closed: works as designed

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @matslats
  • 🇮🇳India arunkumark Coimbatore

    Seems the library is not installed for the Chosen module. Follow the below step to resolve the JS uncaught issue.

    Manual Installation
    1. Download the Chosen jQuery plugin.
    2. [Drupal 7] Extract the plugin under sites/all/libraries
    3. [Drupal 9-10] Extract the plugin under libraries/chosen. Use version 1.5 or higher.
    4. Download and enable the module.
    5. Configure at Administer > Configuration > User interface > Chosen (requires administer site configuration permission)

    Installation via Drush

    A Drush command is provided in the latest versions for easy installation of the Chosen plugin.

    drush chosenplugin

    The command will download the plugin and unpack it in "sites/all/libraries".
    It is possible to add another path as an option to the command, but not
    recommended unless you know what you are doing.

  • Thanks I didn't realise the js library was not installed.
    I can install chosen via drush
    I'm not sure if this operation applies to individual sites or to a whole platform.
    The 'chosenplugin' command completes without giving any details.
    Because I am installing and running many similar sites on the same platform, I need this operation fully automated, either by a line in the installation profile (if it is required per site) or via composer (it is required per platform)
    Can you advise further?
    Thanks?

  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States thejimbirch Cape Cod, Massachusetts

    If you are using a Continuous Integration (CI) process to deploy, you can add the drush chosenplugin command there.

    For example, in a CI script that connects to Pantheon, we added the following command after config import, before cache-rebuild.

    # Move the Chosen Plugin to the correct spot
    terminus -n drush  "$TERMINUS_SITE.$TERMINUS_ENV" -- chosenplugin
    
  • First commit to issue fork.
  • Status changed to Closed: works as designed 5 months ago
Production build 0.71.5 2024