Causes strange behaviour in mysite and freetagging search fields

Zahor - November 4, 2007 - 16:52
Project:Drupal ajaxIM
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

After several weeks of trying to figure out why the mysite module was not working as it should (even had the developer of that module come on to my site) and also why freetagging search fields were acting strangely (if you typed a letter that was not in the list of content, a page of code popped out of the drop down list) I finally realized it was this module. I disabled it, and mysite worked fine and the code no longer showed up.

#1

deadmonk - November 11, 2007 - 10:12

We have a bugfix for this issue. Will be added soon.
Thank you for your comment.

#2

my06 - November 12, 2007 - 13:40

Hello,

I've the same problem with Drupal 5.3 recently installed. I open a taxonomy with free tagging, and when there is no word corresponding, I've strange code written in the auto-completion field. I've not installed mysite module, so what is the problem??

Thanks a lot for your response

#3

Zahor - November 12, 2007 - 15:20

The problem is not the mysite module, it's the ajaxim module. Mysite is just another module that is affected by it. The short term solution is to disable ajaxim for any page that has a free tagging field. So just go to admin/build/block, then configure the ajaxim block and set it to not show up on the pages that you will have free tagging fields. As long as the js file from this module us not being called, free tagging (and any other module that it affects) works fine.

#4

my06 - November 13, 2007 - 09:08

Thank you for this response, but the problem is that I've not installed AjaxIM module in my configuration!!! I added only few other modules, not natives to Drupal 5.3, ie : event, htmlarea, image, og, og_calendar, sitemenu and views...

After a few tests, when I disable the module htmlarea, I've no more problem with strange code with free tagging! So the problem is more complex than that.... I'll try to find out more on htmlarea bugfixes...

#5

L0rne - April 14, 2008 - 23:04

I'm seeing the odd code in the freetagging category dropdown, too.

If it helps any, the code is javascript, from this file

ajaxim/ajaxim/js/prototype.js

beginning line 323.

I'm using the latest version I could find (5.x-1.x-dev)

Deadmonk, could you share what the fix was?

Thank you.

#6

L0rne - May 15, 2008 - 21:36

If I rename prototype.js, I get different code appearing in the autocomplete dropdown. The code comes from

effects.js line 99:

Array.prototype.call = function() {
var args = arguments;
this.each(function(f){ f.apply(this, args) });
}

If I rename effects.js, autocomplete goes back to normal.

Of course, ajaxim doesn't work without these files.

Does this problem crop up everywhere Prototype is used?

#7

L0rne - May 15, 2008 - 22:28

Here is what fixed the problem for me (Drupal 5.5):

autocomplete.js, line 201:

// Prepare matches
  var ul = document.createElement('ul');
  var ac = this;
  for (key in matches) {
    var li = document.createElement('li');
    $(li)
      .html('<div>'+ matches[key] +'</div>')
      .mousedown(function () { ac.select(this); })
      .mouseover(function () { ac.highlight(this); })
      .mouseout(function () { ac.unhighlight(this); });
    li.autocompleteValue = key;
    $(ul).append(li);
  }

To filter out the Prototype js code, changed to

  // Prepare matches
  var ul = document.createElement('ul');
  var ac = this;
  for (key in matches) {
var reg = new RegExp("function()");
if(!reg.test(matches[key])){
    var li = document.createElement('li');
    $(li)
      .html('<div>'+ matches[key] +'</div>')
      .mousedown(function () { ac.select(this); })
      .mouseover(function () { ac.highlight(this); })
      .mouseout(function () { ac.unhighlight(this); });
    li.autocompleteValue = key;
    $(ul).append(li);
}
  }

This is based on some stuff I found in

#47557: autocomplete broken by Prototype library

which didn't actually work for me, but pointed me in the right direction.

 
 

Drupal is a registered trademark of Dries Buytaert.