This issue has been discussed partly in other posts but haven't been resolved yet, I think.
The HS fields work perfectly until you click on an "Add another item" button of another multivalue CCK field inside the same node form. From the firebug console, this is the JS error thrown out:

Drupal.settings.HierarchicalSelect.settings[_hsid] is undefined
[Break on this error] if (Drupal.settings.Hierarchical....settings[_hsid]['updatesEnabled']) {       || Line 279

There is something strange that could help. I have another multivalue CCK field, a Flexifield one. In this particular case, clicking on the "Add another item" button doesn't break the HS components at all. I tried to find out what the differences between those fields are with no luck.

CCK 6.x-3.x-dev (using 2.x branch it happens the same)
HS 6.x-3.x-dev

Thanks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lupas’s picture

Nobody looking into this issue?

Some help would be appreciated.

dyzcypul’s picture

I too have this issue.

dyzcypul’s picture

I have some more information, when the 'Add another item' button is clicked, the Drupal.settings.HierachicalSelect.settings is rebuilt with a new hsid than it had when the page was first built, also each hsid does not have updatesEnabled, which in turn causes the error.

petrica.martinescu’s picture

Issue tags: +hsid hierarchical_select
FileSize
2.38 KB

I have generated the hsid from the element id and changed the js selector to work with the new configuration.

Please let me know if this works for you.

lupas’s picture

I'm afraid it's not working either.
In fact there is a diferrent behaviour. Now, after clicking the "Add one more item" button, the Hierarchical select component doesn't trigger any JSON request. No errors, therefore, seen in the Firebug console.

Thanks for you help by the way

clashar’s picture

lupas’s picture

I finally got it working!

Patch #947030-4: HS stop working when click on "Add another item" button onfa multivalue CCK field was a great piece of work to start with which assigns unique IDs to the HS elements.
The problem I encountered was that every time I clicked on "add one more item" button (actually, any AJAX call within the page), every item in Drupal.settings.HierarchicalSelect.settings array was duplicated.
Additionally, those items were updated without the "updatesEnabled" property set which made the field not to listen for update events.

The attached patch enforces this property to be set and define an static array variable containing the current hsid elements in the page to avoid adding the Drupal.settings.HierarchicalSelect.settings more than once whenever an AJAX call is made.

Hope it's useful for everyone. I don't know what secondary effects can this have to other functionalities of the module (i.e. the Views integration), but this works for mi.

Wim Leers’s picture

Priority: Major » Minor
Status: Active » Needs review
Wim Leers’s picture

NaX’s picture

This worked for me, thanks lupas.

Alphabool’s picture

Status: Needs review » Reviewed & tested by the community

lupas' patch at #7 works fabulously on the 2011-Feb-25 6.x-3.x-dev. Note it does not patch the stable 6.x-3.7 but it's not meant to.

vectoroc’s picture

Why minor ? This bug prevents HS from being used. At least it' normal priority


With path I'm getting next notices (but I applied it to last release 6.x-3.7)
uasort() expects parameter 1 to be array, boolean given in htdocs/includes/common.inc on line 2944.

It was related to update

mansspams’s picture

D7 port of this patch would be welcome addition. UPDATE: I noticed D7 version has changed significantly and port will not cut it, this bug will probably needs fixing in D7 and new issue is in order.

tchopshop’s picture

I think I'm having this same problem when the form is duplicated on a multi-edit page, which is what Acquia's Media Gallery uses to consolidate all the photos in one gallery for editing on the same page. I believe the repetition of the form is preventing HS from working at all. I'm using Drupal 7, so this patch might help if ported.

thanks...

Open Social’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Nice! the patches in #7 are working perfectly for me

vectoroc’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

I use this patch for a half-year and dont see any degradation

vectoroc’s picture

FileSize
3.13 KB

rerolled patch

Alphabool’s picture

vectoroc's re-rolled patch works on the latest 3.8 version. Could the maintainer please port this and resolve this issue?

Gold’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (won't fix)

Tidying up the issue queue. The 6.x version is no longer supported. Only reopen this if it also applies to the 7.x.