Problem/Motivation

Very strange problem, that I'm not sure how to even start truly troubleshooting.

When I try to add a relation to a taxonomy term with the Hierarchical Select interface, I get this error in Chrome's console:

Uncaught TypeError: Object #

has no method 'getEffect' Drupal.ajax.commands.insert ajax.js:482 Drupal.HierarchicalSelect.update.ajaxOptions.success hierarchical_select.js:561 c.extend.handleSuccess jquery.js:143 c.extend.ajax.w.onreadystatechange jquery.js:142
That results in the page just sitting there, trying to load the ajax response, or something. Now, the really odd thing, is that this only happens on my Acquia Dev Cloud server. The copy of the site I have on my local machine works just fine. The only difference between the two, is what computer they are on. My Co-Worker has the same experience. So, any suggestions on how I can troubleshoot/fix this?
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

schmidtk’s picture

Just to provide some more information (We're still having this problem), Firefox provides a slightly different error message:
ajax.getEffect is not a function
http://www2dev.lanecc.edu/misc/ajax.js?v=7.10
Line 482

dgastudio’s picture

same here

grafik’s picture

same here

Barry_Fisher’s picture

I too am getting the Firefox error as described in comment #1.

Trying to debug, but like you say- difficult knowing where to start.

I can also confirm that this appears to be server specific so I'm going to see if there are any settings that may be causing this.

di3gopa’s picture

Same here, and only happens with anonymous user, looks like the response is empty

di3gopa’s picture

Just found that this happens to me when i have more that one form on the same page using hierarchical select, just like this bug on d6 -> http://drupal.org/node/541132

chefnelone’s picture

I have the same problem. Is there any patch to fix this?

chefnelone’s picture

Priority: Normal » Critical
camdarley’s picture

Same problem for me.
I would like to use it for taxonomy based media folders, with media and media browser plus modules.
There is two pages to edit media: one for edit single media, and an other to edit multiple medias on the same page.
The widget works well in the first case, but i have an ajax error in the second. That seems to confirm #6.

joelpittet’s picture

I have been working on a problem very similar, this may help:

http://drupal.org/node/1536230

camdarley’s picture

I try to add $element['#attached']['library'][] = array('system', 'ui'); at line 379 of hierarchical_select.module but it still doesn't work.
Thanks anyway.

jdflorez’s picture

To the people having issues, do you have Jquery Update installed? As joelpittet pointed out, most likely is an issue with this module.

Edit: I have two hierarchical selects (different fields, different vocabularies) in two forms that load on the same page. This problem persists.

dgastudio’s picture

i have disabled jquery update module

the problem still exists...

jdflorez’s picture

I have this error with two forms using hierarchical select displaying on one page. Are you doing something similar?

dgastudio’s picture

no. but really strange..

due to error in db, i have copied all file systems of my drupal installation to new one.

i have create a new db.

enabled SAME modules.

moved all content from old site.

moved all views.

moved ALL fields.

moved everything, that can be movable, with Features

HS works perfectly.

------------

jdflorez’s picture

Ok, I have this situation. Using profile2 and profile2 regpath, I have created two registration forms for different profiles. I created a block with the registration form for each one and placed them in the same page. Both of them have a term reference field and I'm using hierarchical select to display them.

Hierarchical select doesn't work in any of the two forms. It seems that when two forms (that are displayed on the SAME page) use hierarchical select for a field, it breaks because it doesn't discriminate in which form the field is, or something like that. (I deduct this because visually when I use one of the hierarchical select, the other one disappears, neither shows up again and the error has no method 'getEffect' happens).

Any ideas/help would be appreciated

david.gil’s picture

Hi, more info,

it is happening to me too, but the problem is that it only happens in production servers, with the same database and code in one server it is happening and not in other. We are using Acquia Servers, so more or less all is the same, the only difference is that production servers are load balanced and pre-production not.

It seems that all the JS files are the same and loaded in the same order, so no idea why it happens in one machine and not in the other.

Ah!, and i only have one form in the page.

Any idea to test?

David

david.gil’s picture

More info,

if i add this, as said in:
http://drupal.org/node/1536230

$element['#attached']['library'][] = array('system', 'ui');

function _hs_process_attach_css_js($element, $hsid, &$form_state, $complete_form) {
  // Set up Javascript and add settings specifically for the current
  // hierarchical select.
  $element['#attached']['library'][] = array('system', 'ui');
  $element['#attached']['library'][] = array('system', 'drupal.ajax');
  $element['#attached']['library'][] = array('system', 'jquery.form');
  $element['#attached']['library'][] = array('system', 'effects.core');    
  $element['#attached']['library'][] = array('system', 'effects.drop');

The JS error not appears, but it seems that the AJAX callback is not working.

david.gil’s picture

Hi,

We have detected why it is not working in Acquia Servers, yesterday we activate "New relic" service and it is adding code to the ajax callbacks, i attatch an screenshot. At least the problem for us is that.

We open a ticket in acquia to ask to solve it, if you are using new relic you must disable it and this works again.

Best!
David

Wim Leers’s picture

Component: Code - Taxonomy » Code
Assigned: Unassigned » Wim Leers
Category: bug » support
Priority: Critical » Normal

So was everybody who had this problem using New Relic?

Or did some of you maybe use jQuery Update at some point but then not clear the CSS/JS cache to check if that was the problem?

Neither of the above necessarily imply a bug.

schmidtk’s picture

Problem stopped happening for us when we left Acquia, which lends weight to the New Relic theory.

acolyte26’s picture

I am also running into the same problem. Has anyone found the cause of the problem? and are there any patch or solution?

gleroux02’s picture

I can also confirm this issue. I am using drupal 7.14 with its standard jquery 1.4.4. The scenario where I am seeing this error is such. I have a content type that has a taxonomy reference field that uses HS as its widget. On the same content type I have a media field. The media types also have a taxonomy reference field that uses HS as its widget. When editing a media item from the content type, the edit form loads via a ctools modal. When trying to add a taxonomy item onto the media item in the modal I receive the following error:

Uncaught TypeError: Object # has no method 'getEffect'
Drupal.ajax.commands.insert ajax.js:482
Drupal.HierarchicalSelect.update.ajaxOptions.success hierarchical_select.js:561
c.extend.handleSuccess jquery.js:143
c.extend.ajax.w.onreadystatechange jquery.js:142

And the page ends up hanging.

I should also note that it is the same taxonomy reference field on the media type and the content type, which could be contributing to the issue. I also have not tried seeing what would happen with two different fields that use HS on the same content type. I will try this and respond back with the results.

kwabi’s picture

Version: 7.x-3.0-alpha5 » 7.x-3.x-dev
Status: Active » Needs review
FileSize
842 bytes

I think I have nailed this show stopper. Here is a patch that should be used in conjunction with the patch I submitted against the ajax.js file in drupal core. http://drupal.org/node/1702132#comment-6280122 or http://drupal.org/node/1702132#comment-6280242 which is just a well structured one - coding guidelines adherence

Please review and advise.

kwabi’s picture

Version: 7.x-3.x-dev » 7.x-3.0-alpha5

schedule for testing

samhassell’s picture

We are suffering from the same issue since the move to Acquia Dev Cloud. This was working under pretty standard conditions on Ubuntu and Centos servers previously.

As described in #24, the ajax.js patch and the one posted here appear to fix the problem.

NOT marking RTBC coz I don't understand the full technical implications of the patch.

sabsbrain’s picture

Version: 7.x-3.0-alpha5 » 7.x-3.x-dev
Status: Needs review » Reviewed & tested by the community

Have applied #24 to the latest DEV version of the module and Drupal 7.15

HS is now updating wonderfully.

I'm going to mark this as reviewed and tested and against DEV since thats the version I used.

iMiksu’s picture

Status: Reviewed & tested by the community » Needs review

I have same problem in same context:

  • Acquia hosting
  • New Relic enabled

#24 didn't worked out for me in version 7.x-3.0-alpha5+9-dev.

After patching the module, I have now this error when using select dropdowns:
Uncaught TypeError: Property 'undefinedToggle' of object [object Object] is not a function

Anonymous’s picture

These patches need to get RTBC....as it stands the module is useless without them. This module is incredibly useful on ecommerce packages, and these patches, plus the error messages really need to be committed at this point. I wish the core patch wasn't necessary, I don't see that getting into drupal without a serious push.

This module is too awesome to let dwindle away!

cesarmiquel’s picture

We were having this exact same problem and it turns out it was an issue with @font-your-face. Its already reported. See here: http://drupal.org/node/1887066 which is a duplicate of: http://drupal.org/node/1481566.

So.. if you are seeing this issue try disabling @font-your-face and if it works then look into a workaround. That's what we did because patching core is out of the question for us.

I'm mentioning this because since this two bugs were not related we spent significant time to realize the issue was incomaptability with @font-your-face.

OnkelTem’s picture

Same here. But my context is different. This happens with a Term Reference field with HS widget, when added via CTools page manager to any Panel.

OnkelTem’s picture

Category: support » bug
FileSize
3.58 KB

This patch fixes and provides:

Related to the issue:

Theming:

  • Fixing minor mistakes
antonimo’s picture

Assigned: Wim Leers » antonimo
Priority: Normal » Critical
Status: Needs review » Fixed

Hey, guys.
today faced with a similar problem.
In fact, not missing a couple of libraries and a small problem with the address of Ajax request.
About the address I still do not understand why this happens, but it is.
solution (webform_custom_component must replaced on your module name):

function webform_custom_component_element_info_alter(&$type)
{
    if (isset($type['hierarchical_select']))
    {
        $type['hierarchical_select']['#process'][] = 'webform_custom_component_hs_process';
    }
}

function webform_custom_component_hs_process($element, &$form_state, $complete_form)
{  
    $hsid = isset($form_state['storage']['hs']['last_hsid']) ? $form_state['storage']['hs']['last_hsid'] : check_plain($element['#value']['hsid']);        
    global $webform_custom_component_hs_process_build_id;        
    foreach($element['#attached']['js'] as $js_id => $js)
    {
        if (is_array($js) && isset($js['data']['HierarchicalSelect']['settings']["hs-$hsid"]['ajax_url']))
        {
            $cache_id = $js['data']['HierarchicalSelect']['settings']["hs-$hsid"]['cacheId'];
            $build_id = '';
            if (isset($webform_custom_component_hs_process_build_id[$cache_id]))
            {
                $build_id = $webform_custom_component_hs_process_build_id[$cache_id];
            }
            else
            {
                $build_id = $complete_form['form_build_id']['#value'];
                $webform_custom_component_hs_process_build_id[$cache_id] = $build_id;
//////////////////////////////////
                drupal_add_library('system', 'ui.core');        
                drupal_add_library('system', 'ui.accordion');
/////////////////////////////////
            }            
            $element['#attached']['js'][$js_id]['data']['HierarchicalSelect']['settings']["hs-$hsid"]['ajax_url']
                = url('hierarchical_select_ajax/' . implode('/', $element['#array_parents']) . '/' . $build_id);            
            break;
        }
    }     
    return $element;
}
Wim Leers’s picture

Assigned: antonimo » Unassigned
Priority: Critical » Normal
Status: Fixed » Needs review

antonimo: please learn how to use the issue queue :)

antonimo’s picture

Create new module and use it code
Don't forget replace webform_custom_component on your module name

willieseabrook’s picture

I experienced this issue on 7.x-3.0-alpha6 and 7.x-3.x-dev using a term reference field.

Patch by OnkelTem in #32 was fundamentally good but not longer applied. Tweaked and rerolled against 7.x-3.x-dev

Fixes the issue for me.

Georgique’s picture

Status: Needs review » Needs work

I've reworked patch in #36 against alpha10, seems it works nice. Will upload it soon.

BertVK’s picture

I applied patch #36 to alpha10 manually but now I get the Drupal message right above the HS element saying the data has been saved every time I select an item from the lists.
The site I'm using this module in is multi language (i18n). When I use a non-English language I get the message. When using the site in English I do not get the message.

Georgique’s picture

Status: Needs work » Needs review
FileSize
1.98 KB

This is reworked patch against the latest dev.
It works well on my project. Let's see what community will say.

mErilainen’s picture

Fixes my problems also. I will leave the code review for someone else, since I'm not a JS guru.

stefan.r’s picture

Status: Needs review » Reviewed & tested by the community

  • stefan.r committed 4f4b604 on 7.x-3.x authored by Georgique
    Issue #1372300 by david.gil, Georgique, kwabi, OnkelTem, willieseabrook...

  • stefan.r committed eac2fc5 on 7.x-3.x
    Issue #1372300 by david.gil, Georgique, kwabi, OnkelTem, willieseabrook...
stefan.r’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

UmarSharif’s picture

FileSize
28.86 KB

i am getting same error, after uploading bulk files using "plupload" module.