Is there any hope that you will make 6-x branch of this module?

#23 1223556-6x_version-23.patch2.85 KBaidanlis


Xano’s picture

We could do a backport once the Drupal 7 branch is stable. The code base is very small, so it should not be much work.

Pol’s picture

Hello Xano,

Chosen needs jQuery >= 1.4 and I don't think it's available on D6.
Aniway, I'll focus myself on the D7 version, I need to learn D7, so it's a good start.

Nice commits btw ;-)

Have a nice day.

Liliplanet’s picture

Version:» 7.x-1.x-dev

subscribe thx! for 6-x ..

janusman’s picture

subscribe =)

Vacilando’s picture


Ken Hawkins’s picture

I have yet to extensively test using jQuery 1.4.x but it is possible with 6.x.

( Here's how if you use the Adv Agg module )

And it ought not be terribly hard to manually implement the Chosen.js

Load the JS:

  <script src="chosen/chosen.jquery.js" type="text/javascript"></script>

Then specify the CSS id/classes the plugin applies too:

  <script type="text/javascript"> $(".chzn-select").chosen(); </script>

All that said, I've asked the Chosen JS maintainer about what it would take to do a 1.3.x backport

evlad’s picture


GiorgosK’s picture

I would love to see a 6.x version
here is a similar project that works with views select boxes that you might want to look into

esource’s picture

@Xano and Pol,

For an internal project at our company the software development team is planning on porting this module to D6 on our own, the success of which we'd be sending back here so it's available to everyone.

Would you be available to assist if we had a few questions?


Pol’s picture

@esource: yes I'm available if you need something ;-)

esource’s picture

Just sent you a PM pol, let's chat about my approach and some basic stuff.

Ken Hawkins’s picture

As an FYI, I've manually implemented the Chosen jQuery library using the steps I mentioned in #6.

One byproduct of using jQuery 1.4x in Drupal 6.x is that the dragable row widgets break (blocks, views, etc)

Here is a code patch that allows that to work.
(If you're using jQuery update you'll need to update the file in /sites/all/modules/jquery_update/replace/tabledrag.js instead)

RCS file: /cvs/drupal/drupal/misc/tabledrag.js,v
retrieving revision 1.33
diff -u -p -r1.33 tabledrag.js
--- misc/tabledrag.js 8 Dec 2009 03:10:51 -0000 1.33
+++ misc/tabledrag.js 4 Jan 2010 00:13:35 -0000
@@ -169,7 +169,8 @@ Drupal.tableDrag.prototype.makeDraggable
   // Create the handle.
   var handle = $('<a href="#" class="tabledrag-handle"><div class="handle">&nbsp;</div></a>').attr('title', Drupal.t('Drag to re-order'));
   // Insert the handle after indentations (if any).
-  if ($('td:first .indentation:last', item).after(handle).size()) {
+  if ($('td:first .indentation:last', item).length) {
+    $('td:first .indentation:last', item).after(handle);
     // Update the total width of indentation in this entire table.
     self.indentCount = Math.max($('.indentation', item).size(), self.indentCount);
Crom’s picture

Exciting project. D6 port would be fantastic for jq 1.3...subscribing.

@ken Hawkins - any chance of posting the module you created or some step by step instructions?


mthomas’s picture


cposer’s picture

Subscribe =)

Leksat’s picture

Priority:Minor» Normal

I found a workaround for D6.

Here is an example:

// Don't forget to clear Drupal caches after adding this hook!
 * Implementation of hook_preprocess().
function MY_MODULE_preprocess(&$vars, $hook) {
  if ($hook == 'page') {
    $vars['styles'] = '
      <script src="/sites/all/libraries/jquery-1.4.1/jquery-1.4.1.min.js" type="text/javascript"></script>
      <script src="/sites/all/libraries/jquery.chosen/chosen/chosen.jquery.min.js" type="text/javascript"></script>
      <script type="text/javascript">
        jq141 = jQuery.noConflict(true);
    ' . $vars['styles'];

After that you can use Chosen plugin using javascript code like this:

This works fine for me. And yeah... How it works...
The idea came to me with a help of this page -
We can add to page isolated copy of Jquery of any version. In my example I used Juery 1.4.1 inside variable "jq141". Right after including Jquery, we have to include Chosen plugin.

The only trouble I met is that all javascript code we need to include must be evaluated before any other scripts. I resolved this by overriding $styles variable in hook_preprocess().

(I performed just a basic tests for this workaround.)

nottaken’s picture


Leksat’s picture

Status:Active» Needs review

My example (#16) is working fine for me.
Is such workaround admissible for using in 6-x version of the module?

kotnik’s picture


Manuel Garcia’s picture

Status:Needs review» Active

I don't believe #16 would be a valid solution.

The way to go would be to require jquery_update module, but currently in D6 it only upgrades jquery to 1.3.2.

There is work being done in jquery_update to upgrade jquery to 1.6 so perhaps we should first work on this here:
#1067290: Fix jQuery 1.7 for Drupal 6

barraponto’s picture

What if we work using the mootools version of chosen? I'll give it a try today (since it seems easier than fixing jquery update for jquery 1.6).

aidanlis’s picture

Title:6-x branch» 6.x branch

jQuery 1.7 is up and running with Drupal 6, See

aidanlis’s picture

new2.85 KB

Here's a port to 6.x. I'll maintain it if you like?

kotnik’s picture

aidanlis, your patch depends on jquery_update patch in #1067290: Fix jQuery 1.7 for Drupal 6?

aidanlis’s picture


aidanlis’s picture

Status:Active» Needs review

Can we get this committed please?

barraponto’s picture

@aidanlis: can you put the 6.x branch in a sandbox? It will make it easier to try (and debug).

arshadcn’s picture

I created a 6.x branch and applied the patch from #23.

To get it working in D6, you'll need jquery_update module and the patch here #1067290: Fix jQuery 1.7 for Drupal 6 , see comment #117.

Instructions :

git clone --branch 6.x-2.x
cd jquery_update
git apply jquery_update_17-1067290-116.patch

It works for me. Thanks for your work on this @aidan. I added you as a maintainer. :)

aidanlis’s picture

Status:Needs review» Fixed

Awesome! To make it easier, I've created a sandbox for the jQuery Update 6.x-3.x branch and I've updated the README.txt with the details. Thanks Arshad.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

kalessil’s picture

#16 is too CPU time expensive way + JS errors inside chosen event handlers (it will reference to jQuery, that will be lower version already).
Also page load speed will be affected.

#28 failed for me. Any ideas?

error: patch failed: replace/jquery.js:1
error: replace/jquery.js: patch does not apply
kalessil’s picture

Take a look on this:

So as a solution you can just do following:


-    container_div = ($ "<div />", {
+    container_div = $('<div />').attr({

-      div = $('<div />', { 'style' : style_block })
+      div = $('<div />').attr({'style': style_block})

And make required extentions of jQuery (you don't need to buy a whole car when you can just order some spares, right ;) )

    first:      function (){return this.eq (0)},
    last :      function (){return this.eq (-1)},
    mouseenter: function (d){return d?this.bind ('mouseover',d):this.trigger (b)},
    mouseleave: function (d){return d?this.bind ('mouseout', d):this.trigger (b)}

jQuery (document).ready (function(){
    jQuery ("form select").chosen ({allow_single_deselect:true});

This is it. In my case its latest Drupal 6, choosen extention and stable release of jQuery update extension.

adamdicarlo’s picture

I'm using the technique from #16 but with jQuery 1.6.4 (as it's what's used on the Chosen demonstration page) just fine, with custom code (no Chosen Drupal module).