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.

Issue fork chosen-3348967

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

matslats created an issue. See original summary.

arunkumark’s picture

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.

matslats’s picture

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?

thejimbirch’s picture

Status: Active » Needs review

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

shipra-14 made their first commit to this issue’s fork.