Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a custom form with hierarchical select element (my own API implementation), next I added to it "#ajax" triggered by "change" action which loads some custom form elements in ajax callback.
In this callback function I return only
$form['item']['extra_fields'];
Everything works well until adding "managed_file" or "file" element, this problem also occurring when adding code below to the form:
$form['#attributes'] = array('enctype' => 'multipart/form-data');
After that when ajax event is triggered hierarchical_select do not pass any values and output some PHP notices:
Notice: Undefined offset: 0 in _hierarchical_select_hierarchy_validate() (line 1932 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Notice: Undefined offset: 0 in _hierarchical_select_hierarchy_generate() (line 1626 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Notice: Undefined index: label_0 in _hierarchical_select_hierarchy_generate() (line 1742 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Notice: Undefined offset: -1 in _hierarchical_select_hierarchy_generate() (line 1752 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Notice: Undefined offset: 0 in _hierarchical_select_hierarchy_validate() (line 1932 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Notice: Undefined offset: 0 in _hierarchical_select_hierarchy_generate() (line 1626 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Notice: Undefined index: label_0 in _hierarchical_select_hierarchy_generate() (line 1742 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Notice: Undefined offset: -1 in _hierarchical_select_hierarchy_generate() (line 1752 of ...\sites\all\modules\contrib\hierarchical_select\hierarchical_select.module).
Please help, I don't have ideas how this could be solved, does anybody used HS in his own module?
Comments
Comment #1
GoldIt's been 5 years since this was raised. I'm guessing it's too late to respond now.
Also, this isn't a Bug Report.