Hi,
I use hierarchical select ("HS") as widget for content taxonomy fields on nodes. I found that behavior, that HS "forgets" complete term path when editing an existing node.
Settings of hs are: "save term path linege" and "force deepest item"
For example: when I create a new node, I save "termA-level1 | termB-level2 | termC-level3".
When I edit that node later, the widget displays only "termA-level1" and there is no option of choosing deeper term-childs. If I choose another term at first level, I can choose deeper childs. Trying to save the node gives an error, as deepest term level is mandatory but HS only selects first level.
As a workaround I have to change level1-term. After that I can choose my original level1-term and than HS offers me children to choose from that term.
I tried both upgrade to HS 7.x-3.x-dev and I not to force deepest level. It is still the same behaviour. The danger of not forcing deepest level is that you forget your tagging information as drupal saves node only with first level tagged.
Has anybody got an idea?
Thanks in advance,
Ralf
Comment | File | Size | Author |
---|---|---|---|
#18 | hierarchical_select-lost_termpath-1585824-18.patch | 1.9 KB | stefan.r |
#11 | hierarchical_select-lost_termpath-1585824-11.patch | 1.85 KB | rooby |
Comments
Comment #1
beanluc CreditAttribution: beanluc commentedI second this, though in my case it's more like "HS forgets taxonomy term completely".
When opening a node for editing, the HS widget has no memory at all of whatever term, parents, whatever, might have been set in a previous save. The only thing that keeps my site from losing data is that this term is a required field, so, users are prompted to re-set the term every time they edit.
Comment #2
Memoskins CreditAttribution: Memoskins commentedI have the same issue, anyone found how to solve this problem?
Comment #3
stBorchertWhile working on the 7.x-release for Multistep Nodeform I ran into a similar problem. When restoring the form part containing the hs-element, its term path was lost.
I was able to fix this by doing a tiny change to
_hierarchical_select_process_calculate_selections()
as well as to_hs_process_determine_hsid()
(see attached patch).Maybe this fixes your problems here, too.
Comment #4
SteffenRHi stborchert - i just checked your patch / tested it on a site and it worked as expected.
SteffenR
Comment #5
Kars-T CreditAttribution: Kars-T commented+1 for the patch.
Comment #6
Wim LeersLots and lots of whitespace changes in this patch that make it harder to review than necessary.
Comment #7
rogerpfaffcorrecting whitespace issues is as important as fixing bugs. it's just to keep up with coding standards I think.
Comment #8
Kars-T CreditAttribution: Kars-T commentedEven if I support the whitespace changes I want this to be fixed and added a version without white spaces.
Comment #9
rooby CreditAttribution: rooby commentedIn this case though the code in the else should be indented. We don't want to fix unrelated whitespace issues but we also don't want to introduce new ones.
Other than that it looks good, and from my testing it fixes the bug where hierarchical select field values are seemingly lost on edit.
Comment #10
rooby CreditAttribution: rooby commentedAlso, this patch introduces an error message on the widget settings edit form:
Because of
$element['#default_value'] is not necessarily an array (or is it ever an array? I'm not sure).
Comment #11
rooby CreditAttribution: rooby commentedAlso, the 3rd hunk in the patch in #8 is unrelated to this issue.
This patch fixes the issues mentioned in #9 & #10 and removes the extra hunk.
Comment #12
rooby CreditAttribution: rooby commentedComment #13
Leeteq CreditAttribution: Leeteq commentedDataloss = Critical.
Comment #15
stefan.r CreditAttribution: stefan.r commentedCommitted, thanks!
Comment #16
stefan.r CreditAttribution: stefan.r commentedThe patches in this issue break hs_menu. Reverting this commit for now.
Comment #18
stefan.r CreditAttribution: stefan.r commentedComment #19
stefan.r CreditAttribution: stefan.r commented