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
Comment | File | Size | Author |
---|---|---|---|
#17 | hs_947030.patch | 3.13 KB | vectoroc |
#7 | hierarchical_select.js_.patch | 566 bytes | lupas |
#7 | hierarchical_select.module.patch | 2.79 KB | lupas |
#4 | unique_elements_id.patch | 2.38 KB | petrica.martinescu |
Comments
Comment #1
lupas CreditAttribution: lupas commentedNobody looking into this issue?
Some help would be appreciated.
Comment #2
dyzcypul CreditAttribution: dyzcypul commentedI too have this issue.
Comment #3
dyzcypul CreditAttribution: dyzcypul commentedI 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.
Comment #4
petrica.martinescu CreditAttribution: petrica.martinescu commentedI 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.
Comment #5
lupas CreditAttribution: lupas commentedI'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
Comment #6
clashar CreditAttribution: clashar commentedmaybe it's related to issue of Multigroup #677582: Using Hierarchical Select/Content Taxonomy field in a Multigroup
Comment #7
lupas CreditAttribution: lupas commentedI 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.
Comment #8
Wim LeersComment #9
Wim LeersMarked #934954: hsid incorrectly passed via jQuery when hsid reaches 100 as a duplicate.
Comment #10
NaX CreditAttribution: NaX commentedThis worked for me, thanks lupas.
Comment #11
Alphabool CreditAttribution: Alphabool commentedlupas' 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.
Comment #12
vectoroc CreditAttribution: vectoroc commentedWhy 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
Comment #13
mansspams CreditAttribution: mansspams commentedD7 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.
Comment #14
tchopshop CreditAttribution: tchopshop commentedI 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...
Comment #15
Open Social CreditAttribution: Open Social commentedNice! the patches in #7 are working perfectly for me
Comment #16
vectoroc CreditAttribution: vectoroc commentedI use this patch for a half-year and dont see any degradation
Comment #17
vectoroc CreditAttribution: vectoroc commentedrerolled patch
Comment #18
Alphabool CreditAttribution: Alphabool commentedvectoroc's re-rolled patch works on the latest 3.8 version. Could the maintainer please port this and resolve this issue?
Comment #19
GoldTidying up the issue queue. The 6.x version is no longer supported. Only reopen this if it also applies to the 7.x.