1

I'm using excellent JQuery upload widget on Drupal 6. Since there is no designated module for that widget (there is for D7, but not D6) I'm adding the necessary files using drupal_add_js (via a helper module).

So the file upload works, but if I add the date pop up to a Drupal form, it causes the JQuery UI (activated by the date pop up) to break.

To be more specific it produces this error message:

"TypeError: $.widget.extend is not a function"

I've read some threads dealing with similar issues and tried to follow some of the suggestions given. As far as I can tell the problem is this:

  1. The JQuery file upload widget uses the jquery.ui.widget.js called from the /fileupload/js/ folder (using drupal_add_js in a helper module)
  2. If I add a date pop up field to a Drupal form the Jquery UI from sites/all/libraries/jquery.ui/ui/ui.core.js kicks in, which already contains jquery.ui.widget causing the error

Now at this point I thought it would just make sense to remove my call to jquery.ui.widget.js but the problem is that:

  1. Other fileupload.js depend on it, and:
  2. The D6 Jquery UI module adds /sites/all/libraries/jquery.ui/ui/ui.core.js AFTER all files included via drupal_add_js, and as a result breaking fileupload as it lacks the jquery.ui.widget support at the time it’s read (and producing the following errors:

    TypeError: $.widget is not a function
    TypeError: $(...).fileupload is not a function )
    

I tried setting the weight of my custom module (by editing the system table in the database) to a high value but still, the Jquery UI files are added AFTER all drupal_add_js files.

If anyone out there could provide some further insight on how to approach this issue that would really help.

Liam Arbel
  • 467
  • 1
  • 7
  • 14

1 Answers1

0

I've seen the same problem in WordPress and it turned out that the plugin using .fileupload() was adding its own version of the Jquery UI and WordPress was adding another. When I removed the additional JqueryUI it worked.

This question led me in the right direction: jQuery UI TypeError: e.widget.extend is not a function

Community
  • 1
  • 1
Pavel Petrov
  • 730
  • 9
  • 11