Hi Guys. How can i hide the none option in taxonomy select?? Thanx


pvdsteen’s picture

Make your hierarchical select field *required.

patoh’s picture

Thanx pvdsteen.. On This.. Is there a way to animate the pop out select list like the ajax loading circle or something so as to show a user somethings happening. wait for it :)

3magnus’s picture

Title: Hide the <none> option » Hide the <none> option for required fields with default value
Category: feature » bug

I have a "Term reference" field using "Hierarchical Select" widget and based on a two-level taxonomy tree. It's marked as "required" and has a "Default value" setted.
Even though the "<none>" option is being printed.

0xfff’s picture

same here.
will look into it tomorrow.

0xfff’s picture

file: hierarchical_select.module
It says in line 1670:
// Prepend a "" option to the root level when:
// - the form element is optional (1), or
// - enforce_deepest is enabled (2), or
// - the dropbox is enabled *and* at least one selection has been added to
// the dropbox (3)

So if you set "Force the user to choose a term from a deepest level", the option will show up event though the field is set to required and has a default value set.

A quick dirty fix is to edit line 1679:
$second_case = $config['enforce_deepest'];
change to:
$second_case = !$config['enforce_deepest'];

I am not sure but maybe better alternative would be:
Line 1681:
if (($first_case || $second_case || $third_case)
change to:
if (($first_case && ($second_case || $third_case))

3magnus’s picture

Status: Active » Needs review

I've solved it changing line 1684 (on 7.x-3.0-alpha5+9-dev**) from:
if (($first_case || $second_case || $third_case) && (isset($special_items) && !count($special_items['none']))) {
if ($first_case && ($second_case || $third_case) && (isset($special_items) && !count($special_items['none']))) {
, closed to what you said on #5-2.

**: Version 7.x-3.x-dev from 2012-Jun-16.

SocialNicheGuru’s picture

Issue summary: View changes

this no longer applies