Hi.

When I configure the widget to add a new item to the taxonomy, it doesn't work.
I am using version 7.x-3.0-alpha6 of hs, and jquery update 7.x-2.3+6-dev.

There are two scenarios.

1) Creating a new content
When I try to add a new item, and select "add new field", then just nothing happens, and no js errors.
Tried to change jquery version, but still the same results.

2) Updating existing content
In this case, the ajax call gets an error (Notice: Undefined variable: config in sites/all/modules/hierarchical_select/hierarchical_select.module on line 582), which seems a bug by the way (I guess initializing $config is missing in that function). Anyway, even fixing that variable problem, the box with "Create" and "Cancel" will show up, but the buttons will trigger no actions, and I won't save any new term.

I'm pretty confident that someone must have had the same issue?

Comments

arancedisicilia’s picture

I solved this by downgrading to versione alpha-5, though I needed a couple of changes to make it work.
No real changes to the logic really, just a couple of bugs, as far as I can see:

In hierarchical_select/includes/theme.inc:

-  array_merge($element['#attributes']['class'], $classes);
-  $element['#attributes']['class'] .= ' ' . implode(' ', $classes);
+  $element['#attributes']['class'] = array_merge($element['#attributes']['class'], $classes);



in hierarchical_select/hierarchical_select.module:

function _hs_process_render_create_new_item($element, $hierarchy) {
+  $config = $element['#config'];
  $creating_new_item = FALSE;



I can create a patch for the alpha-5 version, if anyone interested.

Jean Gionet’s picture

I'm getting the same thing happening with alpha-6
Using alpha-5 with your tweaks makes it work partially..
Selecting NEW doesn't automatically show a field to enter a value. You have to press the UPDATE button in order for the field to show up.
It's still better than nothing! Thanks!

robertoperuzzo’s picture

Issue summary: View changes

I had the same problem with alpha6 one day ago, than I've gone over the module with a fine tooth comb and I found a bug in hierarchical_select.js file at line 567.

I change this function call (alpha6)
Drupal.attachBehaviors(Drupal.HierarchicalSelect.context()[0]);
with this (alpha5)
Drupal.attachBehaviors(Drupal.HierarchicalSelect.context);

Now the creation of a new item on the fly works! :)

Graber’s picture

Works? Not really. The entire form gets submitted and new node is added along with the term, besides, the entire form is validated. The submit element for term addition should have #limit_validation_errors set and also "prevent" set in #ajax setting. This is shit, why put options that don't work? I just uninstalled the module, it sucks.

maulwuff’s picture

#3 works like a charm for me! thanks a lot!

Gold’s picture

Status: Active » Closed (outdated)

The comment at #5 claims it works, it's 5 years old, I can't replicate this.

Closing.