Widget Settings

mrgoltra - January 14, 2008 - 19:32
Project:CCK Taxonomy Fields
Version:5.x-1.2
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:Newbie
Description

Good Day,

I have set the Default value to none but when I test it it selects the first list on the category. I have reinstalled the module and recreated the field in my new content. Any ideas?

Thanks,

Mark

#1

mrgoltra - January 14, 2008 - 19:50

This only happens when the required option is checked, but when I uncheck that option the tags show up. Is this a bug?

#2

unknownguy - December 9, 2008 - 10:55

I have the same problem.

I this it is indeed a bug. The expected behaviour when required is active would be to select the "none" value and force the user to change the selection.
I will try to make a patch for this.

#3

unknownguy - December 9, 2008 - 11:00

The patch is easy:

function cck_taxonomy_widget($op, &$node, $field, &$items) {
  switch ($op) {
    case 'prepare form values':
      $items_transposed = content_transpose_array_rows_cols($items);
      if ($items_transposed['tid']) {
        $items_transposed['tid'] = drupal_map_assoc($items_transposed['tid']);
        $items['default tid'] = $items_transposed['tid'];
      }
      break;

    case 'form':
      $form[$field['field_name']] = array('#tree' => TRUE);
      $vid = substr($field['widget']['type'], 13);

      $vocabulary = taxonomy_get_vocabulary($vid);

      if ($field['required']) {
        //$blank = 0;
        $blank = '<'. t('none') .'>';
      }
      else {
        $blank = '<'. t('none') .'>';
      }

Just change $blank = 0 with $blank = '<'.t('none').'>';

 
 

Drupal is a registered trademark of Dries Buytaert.