when using hierarchical select configured to multiple select, when you choose a first level item, the 2nd level doesn't load. when click the add button the selection isn't added.

attached is a screenshot of the settings.

Comments

arbel’s picture

forgot to mention that the problem only occurs when the hierarchical select is on a step other than the first.

arbel’s picture

any chance you can look at this? i've been trying to figure it out with no success.

vkareh’s picture

Status: Active » Postponed (maintainer needs more info)

I've been trying to set hierarchical_select, but I can't seem to make it work at all! Even on a vanilla Drupal installation. Care to walk me through the whole configuration of it? Which modules you enabled, how's your CCK content type laid out, taxonomy settings, etc...

Thanks

drenton’s picture

Status: Postponed (maintainer needs more info) » Active

I've done a little research on this, and it looks like the issue is with the #access property being set to false by the multistep module.

I've added these lines to the beginning of the multistep_field_access and multistep_form_alter functions for now to get things working.

// do nothing if this is a hierarchical_select_json call
if (arg(0) == 'hierarchical_select_json') {
return;
}

Essentially the problem is with the step variable. The _multistep_get_current_step function gets its step from the arg function, which only has hierarchical_select_json as arg(0).

vkareh’s picture

Status: Active » Fixed

Added a condition for hierarchical select to the new development snapshot. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

vvvi’s picture

Status: Closed (fixed) » Needs work

Still not work( in 6.x-1.x-dev 2010-Apr-19

vkareh please, add also condition for hierarchical select to multistep_field_access function as described drenton in #4

Thanks for nice module

vkareh’s picture

Status: Needs work » Needs review
Issue tags: +Hierarchical Select
StatusFileSize
new1.39 KB

A bit more debugging and I managed to load the taxonomy linked to the hierarchical_select field through $_POST. Using that, I got the step where that taxonomy is supposed to show.

I'm sure there are tons of use cases I haven't thought about, but this should be a good start. I used hs_taxonomy, rather than hs_content_taxonomy.

Please test the patch and let me know.

vkareh’s picture

Status: Needs review » Fixed

I was playing around with this some more and decided to commit it to the latest development snapshot. Please update and let me know if there are still any problems.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Andrew Gorokhovets’s picture

Status: Closed (fixed) » Active
StatusFileSize
new7.83 KB

The problem still remained

vkareh’s picture

Status: Active » Closed (fixed)

It still works well for me, so I'll mark it as closed.

Many times for AJAX calls, make sure that the $base_url in settings.php matches the URL you are viewing on the page. So if you have $base_url = http://www.example.com/, make sure that you are not on http://example.com (notice the lack of www). Same goes for SSL (https). Also, I noticed that the latest version of Hierarchical Select sometimes doesn't properly install the cache tables, which might mean there's something iffy there... try going to update.php and making sure that the HS module has all the updates it needs. Make sure you use the latest version of both modules.

If you keep having the same problem after trying these suggestions, please open a new issue, as this one has already been dealt with.

kiwad’s picture

Title: hierarchical select not working with multi step » hierarchical select + content taxonomy not working with multi step
Version: 6.x-1.x-dev » 6.x-1.5
Status: Closed (fixed) » Active
Issue tags: +cck content taxomony

I get the exact same error than #11

Also, I get some warnings :

warning: Invalid argument supplied for foreach() in sites/all/modules/contrib/multistep/multistep.module on line 825.
warning: uasort() [function.uasort]: The argument should be an array in /includes/common.inc on line 2935.

This happens with Hierarchical Select + Content Taxonomy

Renaming the issue to be more specific

mtset’s picture

I'm getting the exact same error. It occurs only when the multi-select is on a step other than 1. I get many warnings foreach() as with Kiwad's above comment for line 825 as well as the uasort() error on 2935.

Should I find a solution I'll post it here.

mtset’s picture

Further to this issue: if you set the HS field to appear on All form steps it works in all steps, but if I switch it to only appear in step 3 it fails. Also, I get "Received an invalid response from the server" when I try to remove a selected term from the list.

If I then go to the settings page for that field, I get a page full of:

# warning: Invalid argument supplied for foreach() in /public/home/facultyprofiles/sites/all/modules/multistep/multistep.module on line 825.

With one of these in the midst of those warnings:

# warning: uasort() [function.uasort]: The argument should be an array in /public/home/facultyprofiles/includes/common.inc on line 2884.

Jadea’s picture

Status: Active » Needs work

I'm getting the exact same errors.

Then I tried to add the patch, getting error "Hunk #1 FAILED at 707".
OS is Windows7 64bit, patch added with Cygwin.

Any Idea how I can make the patch work? Or is there an alternative to Hierarchical Select that works with Multistep?

kiwad’s picture

The patch was already commit (see #9) and there is been a release since

shaneonabike’s picture

+1 experience too

mtset’s picture

Status: Needs work » Active

Further on this:
As per this comment I tried to I uncommented the $base_url in the settings.php and set it to the proper site base url. I received the same errors.

Being that HS works on all steps but doesn't work when we specify the step, I may attempt a workaround where we leave the setting to "all" but programatically hide the widget using form_alter for all steps except for the one the desired step. Not ideal, as it moves this control out of the UI, but it may be a good workaround for now.

More news soon.

mtset’s picture

So to recap, I have a Content Taxonomy Field for a given taxonomy. When it's set to appear on all steps, it works fine with HS. When it's limited to only appear on step 3 (using the multistep UI) it fails with the errors above.

I have updated to the latest version of HS and have installed the dev snapshot of multistep.. still no luck.

I attempted to insert the following code into a hook_form_alter for this particular form. (This is somewhat of a sloppy and desperate attempt to fix this issue)

$type = "myCCKType";
$step = _multistep_get_current_step($type);
$desired_step = 3; //the step in the multi-step form that we want this HS to appear in
if($step!=$desired_step)
{
    unset($form['field_content_taxonomy_field']);
}

This code works to hide the field on the other steps and the HS widget appears on the 3rd step, but it still causes the Invalid Response error, as above. I'm unclear how or why that would be.

It also triggers the "Invalid argument supplied foreach()" in line 825 of the multistep.module on the next page you load. The code at line 825 is as follows:

    foreach ($_POST['taxonomy'] as $vid => $config) {
      if ($config['hsid'] == $hsid) {
        $step = variable_get('multistep_extra_taxonomy_' . $vid . '_' . $type, $step);
      }

Above this is a comment that says

// @see http://drupal.org/node/566682 - Added support for hierarchical_select.

which references this thread.


Somehow the "taxonomy" value of the form isn't being populated when you limit the widget to only appear on one step of the form.

Stranger still, inserting an "unset" (even though conditional) into the code breaks this in the same way.

I considered using JavaScript and executing that conditionally if $step!=3 to hide the form, but HS generates its wrapper IDs using an incremented counter, so that's not easy to do.

I feel like in order to get a handle on this we'd need some support from one or both of the maintainers of these modules (HS and multistep).

Does this make any sense to anyone?

kiwad’s picture

Updating my case :

1 - I put my content taxonomy field into a fieldgroup
2 - I select this field group to only show in Step 1
3 - I populate step want and go to Step 2
4 - It saves the data as expected in the table content_field_xxx
5 - But it shows a lot of warnings
warning: Invalid argument supplied for foreach() in /sites/all/modules/contrib/multistep/multistep.module on line 825.

6 - In my DBlog there is also a report about missing hierarchical_select_json if this is the source, it my be related to this thread : http://drupal.org/node/538022

kiwad’s picture

Updating, hopefully mtset you're still working on this and could do some tests to validate...
I'm commenting lines 517 to 553 and 823 to 830 in multistep.module (v1.5)
Since i'm only using CCK content_taxonomy in my forms, I don't need to manage taxonomy in a different way then other CCKs
I guess it's not really a clean way to handle it but it seems to be working and hope there won't be side effects... I need to do more tests
My second guess : next step would be, if this is confirmed for content taxonomy, patching multistep to handle differently CCK Content taxonomy and a Vocabulary...

Edit : false positive...wasn't it

kiwad’s picture

Or is it false negative...

I think the issues may not be related.

On an other instance, I only have warning about hierarchical json

Deleting few lines as mentionned above solved it

vkareh’s picture

Title: hierarchical select + content taxonomy not working with multi step » hierarchical select not working with multi step
Version: 6.x-1.5 » 6.x-1.x-dev
Status: Active » Closed (fixed)
Issue tags: -cck content taxomony

I'm reverting this issue back to 6.x-1.x-dev, where this issue is fixed.

If you have a new issue (e.g. interaction with Content Taxonomy), that's a separate issue that has to be filed accordingly, as this one has been fixed since summer.

juantoyoshi’s picture

Title: hierarchical select not working with multi step » hierarchical select not working with multi step

+1
suscribe

ufku’s picture

Those who have a similar issue with content-taxonomy can follow up from #1017044: Problem with content taxonomy + hierarchical select

miccil’s picture

I applied path from post #26 and worked like a charm for me.

fawwad.nirvana’s picture

I have created multistep form with help of

link and created hierarchial select in step 1.It is working for step 1 but when i click next button and goes to step2, and return step1 it is not working.