I have this problem since my first rc1 testing installation and I was hoping that it will disappear when official Drupal 7 release but unfortunately is still here.

The symptom is quite simple. Drag and drop ordering (at admin/structure/block etc) just dont work.
After some searching with firebug I saw an js error in tabledrag.js file.
The error message is "$.cookie is not a function" and direct me in line 168 were (i think) some cookie reading happens.
After I deleted that cookie checking, drag and drop worked as excepted but is really annoying to have this function deleted on each installation and probably after any core update...

I have testing this with several Drupal 7 installations from rc1 to official and the problem is always there right from the start without any other module or theme installation.

I also find strange that I dint find other people have this problem.
Can someone please help me solve this?

Comments

unik’s picture

Moved from "post installation" forum.

WorldFallz’s picture

if you haven't checked the core issue queue I would start there. If you did and there's no similar issue, then you should create one. The odds of getting the right eyes on a d7 issue in the forums is still pretty rare at this point.

unik’s picture

Thanks for clearing this out for me.
After some more search in issue queue I think I found a similar issue so I guess Im gonna follow it for a while to see...

unik’s picture

I have finally found out what causes this error.
It seems that there is a mod_security rule that preventing misc/jquery.cookie.js access and cause javascript errors every time a cookie check happens (as it does in tabledrag.js).

Unfortunately I have not find a solution (without having access to apache configuration).

unik’s picture

At last I have my javascript working as it should.

What I've done is a copy of /misc/jquery.cookie.js file and put it in my theme's (bartik) directory.
I renamed it from jquery.cookie.js to jquery_cookie.js and put it to my template by adding:
scripts[] = jquery_cookie.js
to my bartik.info file.

Hope this will save someone's else time.

sudotrin’s picture

What I've done is a copy of /misc/jquery.cookie.js file and put it in my theme's (bartik) directory.
I renamed it from jquery.cookie.js to jquery_cookie.js and put it to my template by adding:
scripts[] = jquery_cookie.js
to my bartik.info file.

Thanks so much for posting this. I had been working locally and when I uploaded to a demo server I could not get an editor or a gallery to work. I was going INSANE. Just to clarify - one would have to fix for both the front-end and the administrator theme (just FYI).

I'm going to put my errors under this message in hopes it comes up on someones else's search and saves them some time. If there is a better way to accomplish this - please someone let me know!
****************************************************************
Drupal 7 editor won't work, editor will not show up, editor does not appear
Javascript errors prevent module from loading appearing
jquery.cookie.js not found, not loading
Failed to load resource: the server responded with a status of 404 (Not Found) jquery.cookie.js
shared hosting does not allow jquery.cookie.js, apache jquery.cookie.js

Trin Calway

fauskanger’s picture

I really appreciate you sharing this, as this has been a headache setting my work back hours!

I just want to add that this solved more than on issues on my site:
Now both the ckEditor- and curlypage-modules work for anonymous visitors to the page, which both prior to your solution only showed up for authorized users.

What I don't understand is that the javascript error console "told me" that it was the misc/opeid.js and misc/form.js that produced the errormessage "$.cookie not a function" and thus breaking the javascript. After reading on http://drupal.org/node/728412#comment-3085056 I got suspicious that it was not so.

trickar’s picture

Thank you so much. This has fixed my issue. My worry is having to modify the core themes. The other worry for me is that it worked OK on all themes to start with and then the error suddenly occurred for no reason. I cleared the database and reloaded a clean Drupal site 4 times before finding the error in Firebug and finding your post. Do you think this should be raised again as a core issue?

Thanks a million again.

trickar’s picture

I have now found out why this suddenly started happening. My host updated their ModSecurity rules on all shared/reseller servers to add security pad and to avoid PHP exploits/intrusions.

They said: "So whenever you/your clients are installing any third party applications/scripts then make sure to contact the script vendor to check whether it is 100% compatible with suPHP and ModSecurity."

The also said they will disable the mod security2 rules for those accounts so there won't be any issues. They are being flexible about it.

So now I know why it happened and I know two ways to sort it out. 1. use your brilliant fix above or 2. ask the host to disable the mod security2 rules.

I am very new to Drupal, this has caused me hours of work and I am very glad to find out that it wasn't me or any modules.

limsherwin’s picture

i copied /misc/jquery.cookie.js to my theme's JS directory and added:

scripts[] = js/jquery_cookie.js into the mytheme.info file

but still getting the "$.cookie is not a function" error.

any ideas?

BrightBold’s picture

I've done the same as redwood and also added a 302 redirect per #522646-25: jquery.cookie.js incompatible with Apache mod_security by default. And I asked my host to turn off mod_security for my domains, which they claim to have done. And of course I cleared the cache. Still getting "page not found" errors on misc/jquery.cookie.js. What gives?

beceri’s picture

I change jquery.cookie.js file to jquery_cookie.js
then I change modules/system/system.module

// Cookie.
  $libraries['jquery.cookie'] = array(
    'title' => 'Cookie',
    'website' => 'http://plugins.jquery.com/project/cookie',
    'version' => '1.0',
    'js' => array(
      'misc/jquery_cookie.js' => array(),
    ),
  );

when check my log.I didnot see any file not found mistake.
is that work ?

beceri’s picture

you can go configuration>performance>enable Aggregate JavaScript files.

after that file not found mistake will be lost

I try that is work

mooselimb’s picture

Thank you beceri :)

Simply ticking the 'Aggregate JavaScript files' box worked for me.

If you have admin menu installed go to:
> Config > Development > Performance > Bandwidth Optimization

bricksun’s picture

Millions of thanks! It works for me too.
Go configuration>performance> and enable Aggregate JavaScript files
Marked!

stefmex’s picture

Working fine,

After backup my site and changed hosting server, pffff,....

  • disable/enable rich text/plain text link wasn't enable
  • wysiwyg (ckeditor) wasn't enable
  • drag and drop in blocks / fields management didn't work

Thank you very much !,

So cool (I spent hours looking for a solution)

Triumphent’s picture

configuration>performance> and enabling Aggregate JavaScript Files worked for me. Makes the site run faster too. :) Thanks a million. :)

metakel’s picture

If you click the "Hide row weights" at the upper right corner, the crosshair reappears!

I found that deleting the cookies only reset the settings of your "preference" and so making the crosshair comes back.

bensoi’s picture

before i came into this thread, ive tried aggregating my js files, the drag and drop problem was fixed but new problem occurred, my slideshow doesnt work anymore.
now, i tried unik's suggestion to put a copy of the jquery_cookie.js file inside admin's theme but it throws an error. hmmm..

James A’s picture

I have just come across this issue and did have fun trying to work out what was going on as I had two sites hosted on different servers with the same provider, one worked fine the other didn't. Anyway I did try the aggregate javascript files solution which did resolve the issue but I was somewhat concerned as it then created a JS folder in my sites/default/files directory which was then filling up and didn't go if I unselected the feature. Being new to Drupal I was kind of confused as to whether or not this was a wise thing to do or not, call me a cynic but if it's such a good thing to do why isn't it selected from the start.

Anyway the question is which method is better, copy and recreate the files in the Themes or simply select aggregate javascript files. If it's the latter are there any downsides of doing this?

MhueD’s picture

James--
While you are developing module code (esp. javascript) you will probably need aggregation turned off, because it interferes with testing new functionality. Basically what is happening is that the old code is getting bundled up into a file stored in the background -- which is great for speed, but it keeps things 'frozen' in the stored pattern. A similar thing is true about CSS aggregation (the other similar setting in the Performance screen) except that will prevent you from rolling new changes into your theme. Both features are GREAT once you go live on the site, but on your test/dev site you just have to keep them turned off.