Wim, that problem ( http://drupal.org/node/277522 ) was solved but this one not yet.

When a user choose any value expecting that the sub-level loads, it's not loading.

If it's editing a node and there was a value already in the sub-level, JS tries to reload it but brings the same values again (that doesn't corresponds with that tree).

When trying to save it, got the warnings (this case, for my 3-level HS CT field, it gaves me these 5 warnings):

* warning: uasort() [function.uasort]: The argument should be an array in /var/www/html/includes/common.inc on line 2145.
* warning: uasort() [function.uasort]: The argument should be an array in /var/www/html/includes/common.inc on line 2145.
* warning: uasort() [function.uasort]: The argument should be an array in /var/www/html/includes/common.inc on line 2145.
* warning: uasort() [function.uasort]: The argument should be an array in /var/www/html/includes/common.inc on line 2145.
* warning: uasort() [function.uasort]: The argument should be an array in /var/www/html/includes/common.inc on line 2145.

Now the multiple values are always selected (you really don't save any info in the instance_field table, do you?).

Comments

wim leers’s picture

Component: Code » Code - Content Taxonomy
Assigned: Unassigned » wim leers
Status: Active » Postponed (maintainer needs more info)

1)

you really don't save any info in the instance_field table, do you?

No.

2) On which form is this?

3) Are you altering this form?

4) This is the hs_content_taxonomy module?

(Some things I've asked before but I want clarity.)

If you're on IRC, please join #drupal and ping me.

wim leers’s picture

Even better, do this:

Open includes/common.inc and change

  if (!isset($elements['#sorted'])) {
    uasort($elements, "_element_sort");
  }

to

  if (!isset($elements['#sorted'])) {
    if (!is_array($elements)) {
      drupal_set_message(print_r(debug_backtrace(), TRUE));
      exit;
    }
    uasort($elements, "_element_sort");
  }

And post the output here.

Vuds’s picture

2) It's in a CCK node, working for Bio module to put mandatory fields in the registration, and also working with Node Profile module, to become part of the user account settings.

3) I can say "yes it is", since I had setted this field to be mandatory applied to the register form. In the other way, because of Node Profile, it's also a sub-form node of the user account (because Node Profile insists that has to use the sub-form module to put it as a sub-category form like profile.module). But none of both situations HS is working...

Hmmm wait, you got one point... I had just tried to edit directly the node while I was writing this, and it is working about the sub-levels. But it's not saving yet when saving the form (all in user level, with user access, not admin). No warnings anymore at all, but not saving.

Let me be clear here:
My need: 2 forms for a user that have some obligatory information and some others;
Bio module: It takes de main form and puts its required fields in the register form and JUST do it (it don't takeover the register, it's not associated as a user profile, it's really just the required fields);
Node Profile module: Here I do all the association as a node profile for the 2 forms.

4) Hmmm yes, if it is in a CCK node, then I understand that it's the hs_content_taxonomy. But, since I had enabled again the "view content" for anonymous, other CT widgets (including ActiveSelect) are working perfectly for any user in any node (or Bio or Node Profile or Sub-Form), be anonymous or not.

Answer for #2 is:

Ok, I had put the code. Then I went editing the Node Profile node. Had tried to change a sub-level. It doesn't stop reloading (in a loop, probably). I've got to reload the page. Then got:

Array ( [0] => Array ( [file] => /var/www/html/sites/all/modules/hierarchical_select/hierarchical_select.module [line] => 227 [function] => drupal_render [args] => Array ( [0] => ) ) [1] => Array ( [function] => hierarchical_select_json [args] => Array ( ) ) [2] => Array ( [file] => /var/www/html/includes/menu.inc [line] => 418 [function] => call_user_func_array [args] => Array ( [0] => hierarchical_select_json [1] => Array ( ) ) ) [3] => Array ( [file] => /var/www/html/index.php [line] => 15 [function] => menu_execute_active_handler [args] => Array ( ) ) )

One thing that I hadn't note before, in this way configured, registering a new user is working also with sub-levels now. But as 3), it's not saving.

wim leers’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Closed (won't fix)

In the other way, because of Node Profile, it's also a sub-form node of the user account (because Node Profile insists that has to use the sub-form module to put it as a sub-category form like profile.module). But none of both situations HS is working...

Well, this is something I'm unfortunately not willing to put time in. It's possible that one of those modules is the culprit. The only other realistic possibility is that this is a limitation of the Forms API.
You have to know that Hierarchical Select uses very complex Forms API tricks to make it work. This "subform" stuff may well be the cause, and if not, it's simply impossible or too tricky to support.

You know that I provide a lot of support, but this will take too much additional time. You'll have to figure out this for yourself. I'll happily review your patch, but I will stop providing support at this point.

Sorry.

Vuds’s picture

Category: support » bug
Status: Closed (won't fix) » Active

Ok then, in the Node Profile I'll use Active Select instead, because it's just a 3-level hierarchy and it's working on.

But I have tested it in another CCK node, away from this "confusion" of profiles, and it's still not saving the field. No warnings but no saving. And have returned common.inc back to normal.

wim leers’s picture

Then you'll still have to provide much more detailed information. You can add that debug output back to common.inc as it's useful for me to track down the cause.

Also, please upgrade to RC1 which I just released.

Vuds’s picture

Upgraded to RC1, not working.

Common.inc patched as #2 to find bugs. No warnings at all.

Creating a node: put the values normally. Submitted the form, all values saved, but without taxonomy (confirmed by devel). No warnings or errors in all of this operation.

Editing a node: entered in node for edit, the HS field is with default values. Modified all values of all fields, sent the form, all values saved, but without taxonomy (confirmed by devel again). No warnings or errors in all of this operation.

Editing a node with preview: entered in node for edit, the HS field is with default values. Modified all values of all fields, previewed the form, all values appeared (HS field included), all values saved, but without taxonomy (confirmed by devel again). No warnings or errors in all of this operation.

The configuration for the field:

$config = array(
  'config_id'       => 'content-taxonomy-field_grouppost_localizacao',
  'save_lineage'    => 1,
  'enforce_deepest' => 1,
  'entity_count'    => 0,
  'level_labels' => array(
    'status' => 1,
    'labels' => array(
      0 => 'Escolher:',
      1 => '',
    ),
  ),
  'dropbox' => array(
    'status'    => 0,
    'title'     => '',
    'limit'     => 0,
    'reset_hs'  => 1,
  ),
  'editability' => array(
    'status' => 0,
    'item_types' => array(
      0 => '',
      1 => '',
    ),
    'allow_new_levels' => 0,
    'max_levels'       => 1,
  ),
);
wim leers’s picture

Status: Active » Postponed (maintainer needs more info)

Does it work with a different widget (e.g. "Select list")? Sounds more like a content_taxonomy problem to me.

Vuds’s picture

Status: Postponed (maintainer needs more info) » Active

Yes, it works with Active Select, for example.

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)

Please also export the CCK field and post it here.

Vuds’s picture

Title: warning: uasort() and values not being loaded with JS neither saved with the form » values not saved with the form in CCK nodes
Status: Postponed (maintainer needs more info) » Active

Here you go:

$config = array(
  'config_id'       => 'content-taxonomy-field_carro_modelo',
  'save_lineage'    => 0,
  'enforce_deepest' => 0,
  'entity_count'    => 0,
  'level_labels' => array(
    'status' => 0,
    'labels' => array(
      0 => '',
      1 => '',
    ),
  ),
  'dropbox' => array(
    'status'    => 1,
    'title'     => 'Escolhidos',
    'limit'     => 1,
    'reset_hs'  => 1,
  ),
  'editability' => array(
    'status' => 0,
    'item_types' => array(
      0 => '',
      1 => '',
    ),
    'allow_new_levels' => 0,
    'max_levels'       => 0,
  ),
);

I tested now a little bit more, it's not working only with CCK type pages in any condition (of lineage, depth, dropbox or not, etc.) . I have associated the same vocabulary to the Page page and it worked normally.

Vuds’s picture

The CCK field:

$content[type]  = array (
  'name' => 'Carro',
  'type' => 'carropessoal',
  'description' => '',
  'title_label' => 'Title',
  'body_label' => '',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => false,
    'sticky' => false,
    'revision' => false,
  ),
  'nodefamily_max' => '0',
  'nodeprofile' => 0,
  'comment' => '2',
  'flatcomments' => 1,
  'privatemsg_link' => 
  array (
    'node' => false,
    'teaser' => false,
    'comment' => false,
  ),
  'og_content_type_usage' => 'omitted',
  'old_type' => 'carropessoal',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'ant' => '1',
  'ant_pattern' => '',
  'ant_php' => 0,
  'old_og_content_type_usage' => 'omitted',
);
$content[fields]  = array (
  0 => 
  array (
    'widget_type' => 'content_taxonomy_hs',
    'label' => 'carro_modelo',
    'weight' => '0',
    'description' => '',
    'group' => false,
    'required' => '1',
    'multiple' => '1',
    'fake_multiple' => '1',
    'save' => 'tag',
    'vid' => '16',
    'tid' => '0',
    'depth' => '3',
    'field_name' => 'field_carro_modelo',
    'field_type' => 'content_taxonomy',
    'module' => 'content_taxonomy, hs_content_taxonomy',
  ),
);
Vuds’s picture

I've got more refining in the error:

As suggested by another user in the other topic, I have changed the way to save HS field from taxonomy only to both (CCK field and taxonomy). Since I had not read anything about this issue (of saving the value in the CCK field was not working and you had said to me to use tag only saving) had been solved, it was a surprise for me that it's now working. So, it saves the correct values in the CCK field now, but taking a look at the taxonomy, it's saving a random value from the vocabulary vid=1 (that for me it isn't the same vocabulary used for this HS field), as I confirmed verifying the devel module.

In the other saving options, CCK field saving saves the value in the CCK field, and the tag saving is not saving anything.

wim leers’s picture

Category: bug » support
Priority: Normal » Minor
Status: Active » Postponed (maintainer needs more info)

This is all very weird. The only save option that has always been supported is 'tag', which is what you used. It most definitely works just fine for me. I have absolutely no idea why it won't work for you.
I'll need SSH/FTP and Drupal admin access if you want this fixed.

Vuds’s picture

Category: support » bug
Priority: Minor » Critical
Status: Postponed (maintainer needs more info) » Active

Wim, I don't have how to show it to you since I'm still in development with the site in my virtual machine and it's not on the web, unless you'd like to receive a copy of the site and the SQL structure database.

Besides that, I'm not the only one that is having problems with this issue:

http://drupal.org/node/286298

wim leers’s picture

Unfortunately I managed to reproduce this. Which means the pain with content_taxonomy once again recommences…

AD-DA’s picture

There are some combination of parameters which works for me. I think that the taxonomy get saved correctly if the field is setup to save the deepest term only.

peterzoe’s picture

subscribe

crea’s picture

subscribing

liliplanet’s picture

Version: 5.x-3.x-dev » 5.x-3.0-rc1

same problem here : warning: uasort() [function.uasort]: The argument should be an array in /home/mysite/includes/common.inc on line 2145.

selecting a category with HS in my node profile gives above error.

also when 'enable multiple selections', in my case 3. when I add one category, it creates multiple 'remove's', about 4 of them without the categories, and every time I hit 'remove' it creates another batch. hmmm ...

look forward to any help and thank you.
Lilian

Vuds’s picture

Version: 5.x-3.0-rc1 » 5.x-3.x-dev

Wim, any news?

@Liliplanet, don't change the version of the issue, since dev is the latest one.

wim leers’s picture

I was going to work on this yesterday but didn't find the time. Tonight is my new goal.

liliplanet’s picture

Thank you for your reply. I've upgraded to the dev version (3 August), unfortunately still:

warning: uasort() [function.uasort]: The argument should be an array in /home/mysite/includes/common.inc on line 2145.

Look forward to tomorrow :) ..

Update: I think I've found the problem. When HS loads the 2nd level in my Directory category, it loads the system menu ie. gives choices 'Navigation' or "Primary Links'.

sirpy’s picture

i've traced the problem to the way the process form values is handling the tids when a single tid is present, it should be returned as an array ( tid# => tid#)
so i've replaced the 'process from values' with the code from the content_taxonomy_options and it seems to be working fine for me now
if (isset($field['save']) && $field['save'] != 'tag') {
if ($field['multiple'] && is_array($node_field['tids'])) {
foreach ($node_field['tids'] as $key => $tid) {
if ($tid != 0) $keys[$key] = $tid;
}
}
else {
$keys[$node_field['tids']] = $node_field['tids'];
}
$node_field = content_transpose_array_rows_cols(array('value' => $keys));
}
/**** this is the missing part ******/
else {
if (!$field['multiple']) {
$value = $node_field['tids'];
$node_field['tids'] = array();
$node_field['tids'][0] = $value;
}
}
break;

peterzoe’s picture

hi sirpy,

could you go into more detail on where exactly you made the changes? file, line, etc...
i will then test your changes on a plain vanilla installation.

cheers, peter.

liliplanet’s picture

Hi Sirpy,

Also same, where did you make the changes please .. did you solve the problem?

Look forward to hearing from you.
Lilian

peterzoe’s picture

Hi Lilian,

found the spot:
file: hs_content_taxonomy.module
lines: 306-317 I commented these out and copied this code in there:

if (isset($field['save']) && $field['save'] != 'tag') {
if ($field['multiple'] && is_array($node_field['tids'])) {
foreach ($node_field['tids'] as $key => $tid) {
if ($tid != 0) {
$keys[$key] = $tid;
}
}
}
else {
$keys[$node_field['tids']] = $node_field['tids'];
}
$node_field = content_transpose_array_rows_cols(array('value' => $keys));
}
/**** this is the missing part ******/
else {
if (!$field['multiple']) {
$value = $node_field['tids'];
$node_field['tids'] = array();
$node_field['tids'][0] = $value;
}
}
break;

Seems to be saving the terms now.

cheers, Peter.

summit’s picture

Hi Peter,

Which version of jquery_update are you using, the 2.0 or a specific 2.dev. In my instance (latest jquery dev 2008-Aug-02)?
My HS taxonomy widget doesn't move further after pushing ADD (the hourclass is showing then and nothing happens).

greetings,
Martijn

wim leers’s picture

Title: values not saved with the form in CCK nodes » content_taxonomy widget not properly working when chosen a single term
Status: Active » Fixed

sirpy and peterzoe: thanks :) I *thought* I was using the exact same code, turns out I wasn't!

Also, your code *fails* to set normal taxonomy tags when using "both", peterzoe, so I had to made a small change.

Committed and hopefully this is the final chapter of the book called "content_taxonomy: The Universe's Best Torture Techniques"!

Vuds’s picture

Does that mean that it's working with all saving options right now?! Sweet!

Thanks very much!

liliplanet’s picture

Status: Fixed » Active

Hi Wim,

Hope you are very well.

Uninstalled HS, jquery_update and reinstalled the latest, yet still the same problem : warning: uasort() [function.uasort]: The argument should be an array in /home/mysite/includes/common.inc on line 2145.

Wim, I sent you full admin privileges about 2 days ago via the contact form, do you perhaps have a moment to have a look .. would you like me to send them to you again?

Look forward to hearing from you.
Lilian

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)

Do the others also still have the same problem?

Liliplanet: I got your details, but I'd like confirmation from others first. I think you might have a separate issue. However, since you still have problems, this is unfortunately not true:

… hopefully this is the final chapter of the book called "content_taxonomy: The Universe's Best Torture Techniques"!

:(

peterzoe’s picture

Hi Wim,

can't confirm, I don't get such error.

cheers, Peter. And thanks again for this awesome module and all your commitment.

liliplanet’s picture

Hi Wim,

Have tried every possible configuration, and promise, always the same error ..

Shall I go back to version 5.2 perhaps? That work fabulously for me, but love the new 'node count' in 5.3.

Look forward to any reply and again thank you.
Lilian

(forgot to mention, 5.3 works perfectly in the config preview, just on the edit of the user page, no happiness)

Vuds’s picture

Hi Wim,

I think that Liliplanet is having the issue that is first related here in this topic, like my problem with Node Profile and SubForm_Element modules. It's not working with HS yet (I had moved to get it working with activeselect instead). That time you said you won't get it corrected, as in #4, but now there is more one person with the problem.

I have not tried yet the new version of dev, but i saw the code in CVS yesterday and I have faith that it will restart to work normally again.

Thanks and congratulations for the awesome module fully working (now just minor bugs, I think)!

wim leers’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

peterzoe: thanks for the confirmation!

Liliplanet: I suspect Vuds is right here. I'll only look at your problem if you can reproduce it on a fresh install with only the absolute minimum of additional modules.

liliplanet’s picture

Thank you Wim. My site is pretty much a vanilla install. Do you still have the login information?

Would love to make this work .. most appreciated.

Lilian

crea’s picture

Hey Wim,
I can confirm with rc2 taxonomy values are saved ok if "save both" option is chosen. And I also don't have any errors Liliplanet mentioned
You guys rock.

summit’s picture

Hi Wim,

I think the module is working great now! thanks a lot for all your support. I vote to get this in core!

The only very important thing for using the module, I think, is: that HS has to have a higher weight than HS Taxonomy (which is already standard 1). But HS Taxonomy needs to have a weight heigher than 0 to trigger the widget, right?
So to have this module working great HS needs to have a weight of 2 or higher (depends on other module weights) and HS Taxonomy needs to have a weight of at least 1 to overrule normal taxonomy, right?

EDIT: Saving the module in sites/all/modules is very important, than the weight problem didn't occur to me.
Content_taxonomy still not stable for saving terms in my situation. I had to disable content_taxonomy that was the only thing that helped and filed an issue on CT: http://drupal.org/node/298547

greetings,
Martijn

asak’s picture

subscribing.

asak’s picture

I'm getting the following errors when using "save term lineage" with 3.x-rc6:

warning: Illegal offset type in /home/.../hierarchical_select/modules/hs_content_taxonomy.module on line 318.

warning: Illegal offset type in /home/.../hierarchical_select/modules/hs_content_taxonomy.module on line 318.




warning: Illegal offset type in isset or empty in /home/.../taxonomy/taxonomy.module on line 1174.

warning: Illegal offset type in /home/.../taxonomy/taxonomy.module on line 1175.

warning: Illegal offset type in /home/.../taxonomy/taxonomy.module on line 1178.

warning: Illegal offset type in /home/.../content_taxonomy/content_taxonomy.module on line 134.

Should this thread solve this issue?

Perceptum-1’s picture

Im also getting this ...

Should this be solved ?

Bryan