I have used hierarchical select form element twice in a form with hs_taxonomy configuration. Default value works correctly in the first element but there is a problem in second element. In the first element I just pass an integer to default value and selected item will be set in 3 select elements. In second hierarchical select element I should pass an array of selected items.

CommentFileSizeAuthor
#2 hs_menu_multiple_elements-1448256.patch1.26 KBayalon

Comments

ayalon’s picture

Component: Code - Taxonomy » Code
Priority: Normal » Critical

I have the same problem and it can be easy reproduced:

1. Enable hs_menu for a content type
2. Create a taxonomy reference field
3. Enable HS Select for Taxonomy
4. Select a term and save the content
5. Create a new menu (not navigation)
6. Create a Navigation Element with 2 parents

If you try to edit the menu, the default value of the taxonomy term hs select will be used. The menu item is los (no default value).

After disabling HS Taxonomy, the default menu item will reappear.

This is critical, because save the content will kill the existing menu item.

ayalon’s picture

Title: default value issues » Mixing hs_menu (Menu) and hs_taxonomy (Taxonomy) on the same page, missing default value
StatusFileSize
new1.26 KB

After 2 hours of debugging I finally unterstood the problem here and was able to fix this issue.

This error occurs only on EDITING an existing page. On content creation this is not relevant, because no menu item is available as a default value.

The problem is a check of the $form_state['input'] variable that is not empty it multiple fields are on the same page. It is better to check for the 'op'.

Please test this patch and include it in the next dev version. I'm probably not the only one wo's suffering from this bug.

wim leers’s picture

Priority: Critical » Normal
Status: Active » Needs work

At the very least, the patch needs to be cleaned up. Plus, it needs further review; others should confirm this indeed fixes the problem.

gold’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

In the last 5 years this appears to have been fixed.