Taxonomy reference field selections are being lost at save time when the configuration options Enable level labels and Enable the dropbox are combined with the #size option (as defined in API.txt).

In these cases, I'm observing the following behaviour:

  • If Reset selection of hierarchical select is set to Enabled, then selections are lost immediately when the node form is submitted.
  • If Reset selection of hierarchical select is set to Disabled, then selections are initially saved successfully, but lost if there's a further edit that makes no change to the field.

Path to reproduce

The following were done on a clean minimal install of D7:

  • Enable field_ui and taxonomy.
  • Install and enable hierarchical_select and hs_taxonomy.
  • Create a taxonomy and add some terms to it. (A flat taxonomy suffices here.)
  • Define a content type, add a Term reference field referrring to this taxonomy, using the Hierarchical Select widget.
  • Configure Hierarchical Select for this field as follows:
    • Level labels: Enable, and pick a label for the Root level.
    • Dropbox settings: Enable
    • Reset selection of hierarchical select: Enabled
  • Now either create a custom module containing a form hook to set #size for hierarchical_select fields, or temporarily hack theme_hierarchical_select_select() in includes/theme.inc to explicitly add a 'size' attribute to the rendered HTML.
  • Create a node of this type, and use the HS interface to make a selection.
  • Save this new node. The selection should then be seen to have disappeared!

Further analysis

I did a quick comparison of the form data in the size and no-size cases and saw that the difference is down to the first option (=label) in the select list not being explicitly re-selected after each 'Add' (to dropbox) operation. This results in different data being submitted at Save time. When Level labels are disabled, the '<none>' option does get reselected after each add.

Comments

davemckain created an issue. See original summary.

Gold’s picture

Status: Active » Closed (outdated)

This issue is just over 2 years old now and there has been no discussion on it.

I have been unable to replicate this on the current codebase. Closing as outdated.

The description is well written, if this issue is still extant could the instructions in the description be verified and updated when reopened.