> dave sent a message using the contact form at http://wimleers.com/contact.
>
> This is a quick question for the hierarchical_select module
>
> Which line do I change to make the option say "Choose One:" or
>
>
> If I add a label to the root I just get :
>
> Choose One
>
> taxonomy term 1
> taxonomy term 2
> etc.
>
> Let me know. I have this module working. It's totally the best, but with the ability to change the this could provide a better user experience.
>
>
>

Comments

wim leers’s picture

Status: Active » Fixed

Enable "level labels" and then you'll be able to set that.

It's the first fieldset of the config UI, as can be seen here: http://wimleers.com/demo/hierarchical-select/config-ui.

If that's not exactly what you want (that's not entirely clear to me), you'll have to override theme_hierarchical_select_special_option().

benone’s picture

yes, but for root level still exist as first option under the label I created. How to remove it ?

benone’s picture

the " < none > " , I mean :)

wim leers’s picture

As long as the HS is optional, you can't remove it. But you can override the text through that same theme override ;) (Ugly, but works.)

benone’s picture

I made fileld Required and added the Label , and < none > still is over there.
What you mean writing "As long as the HS is optional, you can't remove it." ?

Status: Fixed » Closed (fixed)

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

beumont’s picture

I want to remove the "" how to do that?

beumont’s picture

Status: Closed (fixed) » Active
sifaan’s picture

Version: 6.x-3.0 » 6.x-3.1
Component: Code - Taxonomy » Code - Content Taxonomy

Hi!

I would also like to know how to not have the displaying
I have set the field as required (and even tried setting the taxonomy I am using as required) but still HS gives me a option.
I have even tried setting a particular term as the default value.

(Of course, I cannot submit the form with selected, the validation rejects it; but I would prefer to not have this option visible at all).

Thanks
/Sifaan

mark.’s picture

Yeah, this bug was a real pain for me to figure out how to fix. My forum vocabulary (programmatically set to required) had the option for no reason. A fix is to go into hierarchical_select.module, go to line 1774 and change this:

  if (($first_case || $second_case || $third_case) && !count($special_items['none'])) {
    $option = theme('hierarchical_select_special_option', t('none'));
    $hierarchy->levels[0] = array('none' => $option) + $hierarchy->levels[0];
  }

to this:

  if (($first_case || $second_case || $third_case) && !count($special_items['none'])) {
//    $option = theme('hierarchical_select_special_option', t('none'));
//    $hierarchy->levels[0] = array('none' => $option) + $hierarchy->levels[0];
    $hierarchy->levels[0] = $hierarchy->levels[0];
  }
wim leers’s picture

Status: Active » Closed (works as designed)

That doesn't solve the problem at all. That just removes the "none" option by hacking the code. It should not be removed.

mark.’s picture

Category: support » bug
Status: Closed (works as designed) » Needs work

In light of multiple users experiencing otherwise, do you stand by what you wrote in #4: "As long as the HS is optional, you can't remove it."?

Since the thread was closed immediately after others explained that is not the case, there's no definitive answer.

inforeto’s picture

#4 says to use the theme override.

Without an override the module automatically inserts the <'none'>:

function theme_hierarchical_select_special_option($option) {
  return '<'. $option .'>';
}

Thus on your theme you can have a function that overrides it:
yourthemename_hierarchical_select_special_option($option)

On it you can add a line like:

if ($option == 'none') { $option = 'Choose one'; }

Naturally only return your text when $option is 'none', because the function is also used for other strings.

Overrides are the drupal way to allow custom changes without altering the module's code or data.

wim leers’s picture

Status: Needs work » Closed (fixed)

Thanks, inforeto :)

drupalnesia’s picture

Version: 6.x-3.1 » 6.x-3.6
Status: Closed (fixed) » Needs work

@Wim Leers: CCK by default not works like that. If we set a field as "Required" than you should not show "< none >" as an option.

Also, if you set HS "Level choice" to "Allow the user to choose a term from any level" then the "< none >" option not available. I found this bug only appear when you set HS "Level choice: Force the user to choose a term from a deepest level".

I'm using HS 6.x-3.6 with Drupal 6.20

Added: when I Choose "< none >" then HS change my selection to "Level label".

wim leers’s picture

I think you replied to the wrong issue?

wim leers’s picture

Status: Needs work » Closed (fixed)

Closing due to lack of response.