When I enable editability status=1 I get four 'undefined offset' errors numbered 1 through 4. I have 5 max levels. I am setting default value of '5' which is a valid tid. Can you advise if I am doing something wrong?

$form['source'] = array(
'#type' => 'hierarchical_select',
'#title' => t('XYZ ABC:'),
'#size' => 1,
'#config' => array(
'module' => 'hs_taxonomy',
'params' => array(
'vid' => 2,
'exclude_tid' => NULL,
'root_term' => NULL,
),
'save_lineage' => 0,
'enforce_deepest' => 1,
'entity_count' => 0,
'require_entity' => 0,
'resizable' => 0,
'level_labels' => array(
'status' => 0,
'labels' => array(
0 => t('Main category'),
1 => t('Subcategory'),
2 => t('Third level category'),
),
),
'dropbox' => array(
'status' => 0,
'title' => t('All selections'),
'limit' => 0,
'reset_hs' => 1,
),
'editability' => array(
'status' => 0,
'item_types' => array(),
'allowed_levels' => array( 0 => 1,	1 => 1,	2 => 1,	3 => 1,	4 => 1,	),
'allow_new_levels' => 1,
'max_levels' => 5,
),
// These settings cannot be configured through the UI: they can only be
// overridden through code.
'animation_delay' => 400,
'special_items' => array(),
'render_flat_select' => 0,
'path' => 'hierarchical_select_json',
),
'#default_value' => '5',
);

Comments

ar-jan’s picture

Title: Invalid indexes when in 'edit' mode » HS Taxonomy: Invalid indexes when in 'edit' mode
Category: support » bug

I have the same problem. Using: D7.12, and only HS and HS Taxonomy.

Configuration: Unlimited number of values, save term lineage, Allow the user to choose a term from any level, no level labels, Allow creation of new terms, Allow creation of new levels.

Adding a root-level terms works fine. Adding a child to that term gives an error: The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved. I can continue to add terms, which are added to the vocabulary, but afterwards I can no longer save the node:
Notice: Undefined offset: 3 in _hierarchical_select_hierarchy_generate() (line 1730 of sites/all/modules/hierarchical_select/hierarchical_select.module). (where the offset number is the number of terms added, minus one).

As long as I add only one term I can save the node, but adding more at one time does not work. Editing the node again after the terms have been created and then selecting the terms does work.

dmatamales’s picture

I'm getting this error as well with offset 1 when I enter the edit form for a field collection entity. It seems to save and load the data fine, though. I believe I have the same configuration as in comment #1. Maybe this error is because I added the HS widget to a field which originally only accepted one delta value... just a guess. Perhaps I will try reconfiguring it to only save the deepest level term, or do it on a new field with unlimited values from the start and see what kind of results I get.

ar-jan’s picture

If you keep having problems you can also see if Simple hierarchical select works for you.

Kars-T’s picture

Priority: Minor » Normal
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

Dear fellow Drupal enthusiasts,

I have set this issue to "Postponed (Maintainer needs more information)".

If not already done please add an issue summary and steps how to reproduce the problem.
And please read again, "Making an issue report".

Help about how to do this can be found on IRC and in the user groups.

After there is new information, please re-open the issue by changing the status to active.

--
This issue was edited with the help of Issue Helper

Gold’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

I've not seen this issue in quite a while. The code has moved a lot in the last 5 years since the last comment.

If this is still an issue please read #4 and reopen with the updates.