Status update page is showing error
"You need to download the Chosen JavaScript file and extract the entire contents of the archive into the sites/all/libraries directory on your server."

Have uploaded chosen-sprite.png chosen-sprite@2x.png chosen.css and chosen.jquery.min.js
As per the video http://www.youtube.com/watch?v=zeI0oInyok0
Have tried both minified.chosen.js and chosen.js

Have tried sites/all/libraries/chosen/chosen.jquery.min.js and
sites/all/libraries/chosen/chosen/chosen.jquery.min.js
as per http://drupal.org/node/1835358

This site uses a multi site BOA (Barracuda/Aegir/Octopus)
files were downloaded from git as zip and sftp up to site directory.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zambrey’s picture

Yeah, I've got the same issue. Seems like new libraries support is broken.
First, according to #1835358: LIbrary requirement for 'chosen/chosen' it shouldn't use additional 'chosen' folder in libraries.
And second, version pattern is wrong.

I've prepared patch that should fix this two issues. It is based on Colorbox implementation of hook_libraries_info().

zambrey’s picture

Version: 7.x-2.0-alpha1 » 7.x-2.x-dev
Status: Active » Needs review

status update

DuaelFr’s picture

Your patch suggests that the person who installs the module has to put the content of the chosen subfolder into the sites/all/libraries/chosen but it is clearly not the case. The good practice is to include the entire library in its folder.
In our case, we will have to play with the chosen subfolder.

I propose two patches (the maintainer can choose the one he prefers) :
- the first removes the path key and so, it prefixes all the included files
- the second, highly inspired by #1, keeps the path key but uses the chosen.jquery.min.js file instead of the VERSION one.

These patches are part of the #1day1patch initiative.

travelertt’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #1 chosen-libraries-1900564-1.patch worked for me. The other patches from #4 didn't work.

Using:
Chosen 7.x-2.0-alpha1+1-dev (2013-Feb-18)
Libraries 7.x-2.1
Drupal 7.21

DuaelFr’s picture

Status: Reviewed & tested by the community » Needs review

My patches only works if you extract the entire chosen library in your sites/all/libraries/chosen folder which is the good practice.
If you only extracted the chosen subdirectory my patches cannot work.

joep.hendrix’s picture

Priority: Normal » Critical
shadcn’s picture

Weird. I had this issue last week. And patch from #1 worked for me.

Today, on another site, chosen 7.x-2.0-alpha1 seems to be working fine, without any patch.

shadcn’s picture

Looks good on Simplytest as well. http://simplytest.me/project/chosen

micromegas’s picture

Patch #1 resolves the issue for me with 7.x-2.0-alpha1

Exploratus’s picture

#1 works for me as well with 2.0 alpha1.

Using Libraries 2.0 and extracted to /libraries/chosen/files go here...

joep.hendrix’s picture

Since this issue is filed against 7.x-2.x-dev I think it would be more appropriate to test the patches against this version instead of the alpha version.

travelertt’s picture

That would explain why it wouldn't work for me. Patches should be set to the latest dev release under the guidelines (http://drupal.org/patch/submit)

micromegas’s picture

Patch from #1 is also working with latest 7.x-2.0-dev.

I tried patch #3 option 1 with the chosen/chosen library location, and it still did not find the library... refreshed the cache, no luck.

Exploratus’s picture

I upgraded to Alpha2 and reapplied the patch and its working. Can we get this committed so we don't have to keep reapplying with every upgrade? :) Seems to work with alpha and Dev.

mike27’s picture

Personally I didn't have problem with Alpha 1 but after upgrading to Alpha 2, I encountered this problem. For the time, I need to downgrade to Alpha 1 until a fix comes up.

Thanks,
Mike

mike27’s picture

For anyone interested:

My problem was that until now I used jquery.js file instead of min.js

Alpha 2 uses jquery.min.js by default. So, if you delete jquery.min.js file it doesn't recognize the library as Alpha 1 release did.

I used jsmini.com to compress the jquery.js file (and keep any changes that I had implemented) and then I used patch #1 which indeed works (only for the jquery.min.js file).

vflirt’s picture

Hi all ,
what i used to make it work :
create folder sites/all/libraries/chosen/chosen
extract the files in the above folder
change chosen_libraries_info as follows:

    'version arguments' => array(
      'file' => 'chosen/chosen.jquery.js',
      'pattern' => '@Version (.*)@',
      'lines' => 4,
    ),

that made it work.

Hope this helps , when libraries is checking for the version file it is not using the 'path' property so i had to add it.

DuaelFr’s picture

vflirt it is exactly what I made in my first patch in #3.

I really think we should follow the Libraries API best practices and use the full library instead of extracting its chosen subfolder.

dddave’s picture

Is this really needed? I just tested with the latest dev of the module and uploaded the whole library into libraries/chosen without any issues.

Sigh. Just noticed that this module has a dev that is significantly older than the alpha. How lovely.

zambrey’s picture

Well, clean alpha2 doesn't work for me. Maybe this is some kind of environment / PHP issue.
I'm using WAMP server with PHP 5.3.13 version.

I've got this error on Status Report page:

You need to download the Chosen JavaScript file and extract the entire contents of the archive into the sites/all/libraries directory on your server.

I've tried both libraries/chosen and libraries/chosen/chosen paths.

dddave’s picture

Version: 7.x-2.x-dev » 7.x-2.0-alpha2

I have a test-instal working without any patching. Just sayin'.

Set the version to alpha2 because this is the latest version out there.

zambrey’s picture

Version: 7.x-2.0-alpha2 » 7.x-2.x-dev
Status: Needs review » Reviewed & tested by the community

As far as I know they are the same and all patches should go against dev version. So setting back to dev.

I guess now it's up to the maintainer to choose patch either from #1 or #3.
My patch is additionally changing library path as per #1835358: LIbrary requirement for 'chosen/chosen' issue which is closed but apparently not fixed.

Setting to RTBC based on comments and to grab maintainer attention.

Manuel Garcia’s picture

Using latest recomended release 7.x-2.0-alpha2 (which is broken afik).

Using the patch http://drupal.org/files/chosen-fix_library_load_1st_option-1900564-3.patch from #3 by DuaelFr, fixes the problem. You should have the files placed like sites/all/libraries/chosen/chosen.jquery.min.js etc.

Manuel Garcia’s picture

actualy make that path sites/all/libraries/chosen/chosen/chosen.jquery.min.js

dddave’s picture

Have we established an explanation why it is working for me without patching and for others not? Can we make sure that the library was correctly installed in the first place? #23/#24 suggest that this might be the real issue.

shadcn’s picture

Yep. Actually both versions alpha and dev are working on simplytest.me.

http://simplytest.me/project/chosen/7.x-2.x
http://simplytest.me/project/chosen/7.x-2.0-alpha2

kait’s picture

Recommended version works for me, but I had to make sure Chosen was placed in sites/all/libraries/chosen the same way it is in the zip file I downloaded from GitHub. Only chosen directory and VERSION file are required inside sites/all/libraries/chosen.
If you copied everything from the zip to sites/all/libraries/chosen, then you should have no problems.

Hope it helps.

tl;dr - chosen structure needs to be like this:

-- sites/all/libraries/chosen
   -- chosen
       -- chosen.jquery.min.js
       -- chosen.css
       -- etc.
   -- VERSION
vflirt’s picture

hi,

what we all missed for this to work is the VERSION file in sites/all/libraries/chosen as you have it. That is the reason it is working. As you see in my comment all i said was that i changed the version file from "VERSION" to chosen/chosen.jquery.js as it was not described well how to install the module.

As all it seems that is just not clear documentation about installing the module and not a code change that is to be done inside :)

Kind Regards,
Dobromir

kait’s picture

I concur @vflirt, installation instructions need to be more clear about this. But I do think the code needs to be changed as well. Extracting the whole archive to libraries directory shouldn't be mandatory. Or at least the version info should come from the javascript file. What do you (or anybody else) think, should it be changed?

scuzzyworks’s picture

Put VERSION back in the libraries/chosen folder, flushed cache and now I'm in business. Documentation needs to be updated.

xbrianx’s picture

Yeah man, the documentation needs updating stat.. Watching the you tube video it says to only copy the js file and that's it.. This was driving me crazy. Put the VERSION file in libraries/chosen/ and the rest of the files in libraries/chosen/chosen/

Mithrandir’s picture

Reading this thread, I wonder if people have realised that the Chosen javascript library has changed recently, so there is no VERSION file anymore.

Either the module should update the library detection and file placement code, or the make file should not just point to the master git branch, but to the 0.9.15 release that is the latest functioning one, as far as I can see.

Dave Reid’s picture

I think this issue and #2021639: Chosen directory renamed to public from chosen, js cannot be added are likely trying to solve the same thing. Patches in 2021639 are looking cleaner than the latest ones here though.

shadcn’s picture

Hi everyone

I'm a bit busy with work right now. Anyone want to help maintain chosen? I'll add you as co-maintainer.

Thanks.

Dave Reid’s picture

@arshadcn: If you need assistance I can help get a new release out that fixes the major blockers and outstanding issues.

shadcn’s picture

We couldn't ask better. Added you as co-maintainer Dave. Thanks ^^

conniemh’s picture

It took me quite a while to figure this out, but after I uploaded the chosen library to my ../sites/all/libraries directory I added a text file named VERSION that contains only the version number (in my case the file contains 0.13.0) and the Drupal module was finally able to recognize the library. Hope this helps others. (...and maintainers, please let me know if this is not a good thing to do for some reason)

Cheers,
Connie

hswong3i’s picture

Update detection for chosen library v0.13.0 via chosen-7.x-2.x-dev.

jwjoshuawalker’s picture

#38 worked for me.

Unrelated note: Chosen doesn't seem to work w/ jQuery update set to version 1.5.

brentratliff’s picture

#38 worked for me as well in order to recognize the library. The module, however, is not working at all. I have tried jquery update set to 1.5,1.7, and 1.8. Chosen is never applied regardless.

bwoods’s picture

I'm using the latest dev version and the patch from #38. On load, I see this javascript error:

ReferenceError: settings is not defined

The issue is "settings" is spelled wrong on line 3:

attach: function(context, setings) {

Making this correction seems to work for me.

EDIT: Looks my suggestion was listed as a separate bug and committed already - https://drupal.org/node/2040753

Hydra’s picture

+1 RTBC
I confirm that the latest dev together with the typo patch in #2040753: bug in chosen.js line 4 make it work again. This should be committed immediately!

dalin’s picture

+1 RTBC
Patch from #38 works with Chosen v0.14.0 + jQuery 1.7.

brentratliff’s picture

Solved my issue as well with Chosen v0.13.0 + jQuery 1.7.

+1 RTBC

xy61qt5’s picture

Priority: Critical » Minor

Bug might be solved when you use 0.14.0 + jQuery 1.7 and v0.13.0 + jQuery 1.7. It must be check these version must be work together with other addons.

brentratliff’s picture

Reality is jQuery 1.7 may break plenty of addons. It's infeasible to check them all. It's better to just list jQuery 1.7 as a requirement as the Chosen javascript library is not going to be handcuffed to jQuery 1.5 as is Drupal core.

joep.hendrix’s picture

Priority: Minor » Critical
Hydra’s picture

Status: Reviewed & tested by the community » Closed (fixed)

Okay, I thought a bit about this issue and decided to not go this solution. I agree with #33. Since their is a 1.0.0 release of chosen, we will use this. Also we switch from hook_library_info to hook_library with a clean version definition of 1.0. This should still work with the core version of Drupal jQuery.
The latest dev version is now including these improvments, hope this solved this issue :)

DenisVS’s picture

Dev version works fine for me.

Anonymous’s picture

Updating to dev and applying patch in #38 fixed this for me.

999csharp’s picture

Yes, I've just created the subfolder called chosen, copied the files in there!!! The module has enabled lovely now. Now its time to have a play with - can't wait - it looks really good.

JohnnyW’s picture

My issue was that chosen folder was named Chose with a capital C instead of lowercase. On localhost with WAMP no problem, but Centos 6 wanted to see a lowercase 'c' on the folder named chosen.