After exporting following element (Date):

  0 => 
  array (
    'widget_type' => 'date_text',
    'label' => 'Data urodzin',
    'weight' => '0',
    'default_value' => 'blank',
    'default_value_custom' => '',
    'default_value2' => 'blank',
    'default_value_custom2' => '',
    'input_format' => 'site-wide',
    'input_format_custom' => '',
    'description' => '',
    'group' => false,
    'required' => '0',
    'multiple' => '0',
    'todate' => '',
    'granularity' => 
    array (
      'Y' => true,
      'M' => true,
      'D' => true,
      0 => 1,
      'H' => false,
      'N' => false,
      'S' => false,
    ),
    'output_format_date' => 'Y-m-d',
    'output_format_custom' => '',
    'output_format_date_long' => 'l, Y,  F j - H:i',
    'output_format_custom_long' => '',
    'output_format_date_medium' => 'D, Y-m-d H:i',
    'output_format_custom_medium' => '',
    'output_format_date_short' => 'Y-m-d H:i',
    'output_format_custom_short' => '',
    'tz_handling' => 'none',
    'timezone_db' => 'UTC',
    'field_timezone' => 'Europe/Warsaw',
    'field_name' => 'field_data_ur',
    'field_type' => 'date',
    'module' => 'date',
  ),
);

...and importing again, I've got errors:
An illegal choice has been detected. Please contact the site administrator. (from filter_form_validate() function in filter module)
And from logs:

Type	form
Date	Friday, 2008, January 25 - 11:37
Message	Illegal choice 0 in Granularity element.
Severity	error
Hostname	127.0.0.1

There is issue with exporting element (cck module or date module issue).
Should be:

    'granularity' => 
    array (
      'Y' => true,
      'M' => true,
      'D' => true,
      'H' => false,
      'N' => false,
      'S' => false,
    ),

instead of:

    'granularity' => 
    array (
      'Y' => true,
      'M' => true,
      'D' => true,
      0 => 1,
      'H' => false,
      'N' => false,
      'S' => false,
    ),

The problem is with '0 => 1', without this is working fine.

CommentFileSizeAuthor
#3 nodereference.module.patch1.87 KBkenorb

Comments

kenorb’s picture

The same with 'referenceable_types':

    'referenceable_types' => 
    array (
      'blog' => false,
      'book' => false,
      0 => 1,
      'client' => false,
...
gdd’s picture

subscribe

kenorb’s picture

Title: Illegal choice 0 in Granularity element. on Importing (Date element) » Illegal choice 0 in ... element. on Importing (Date element) - An illegal choice has been detected.
Component: content.module » nodereference.module
Status: Active » Needs review
StatusFileSize
new1.87 KB

For 0 => 1 problem in 'referenceable_types', 'referenceable_roles', etc. sections:
patch is here: http://drupal.org/node/216295

For nodereferences problem (with invalid default value), patch in attachment.

For granularity problem after exporting invalid data:

    'granularity' => 
    array (
      1 => true,
      0 => false,
    ),

you can fix it manually settings correct values to e.g.

    'granularity' => 
    array (
      'Y' => true,
      'M' => true,
      'D' => true,
      'H' => false,
      'N' => false,
      'S' => false,
    ),

P.S. If you have still 'An illegal choice has been detected.' message:
- And you have still 0 => 1 values after exporting, clear the cache and try to check in database in node_field table, global_settings row on selected field:
'field_some_name', 'nodereference', 'a:1:{s:19:"referenceable_types";a:52:{i:1;i:1;i:0;i:1; ...
delete i.e. "i:1;i:1;i:0;i:1;" (it's equals to: 1 => 1, 0 => 1)
- If you got: 'The default value is invalid.' error, try to disable 'required' (set to '0').

gdd’s picture

Patch applied and my export works now. This was a really complex content type with about 30 CCK fields and it imported perfectly, which is great since I was not relishing recreating it by hand a few more times as I deploy. +1 and thanks.

kenorb’s picture

Sometimes there is another bug with default value, there are two similar sections after exporting:

    'default_value_widget' => 
    array (
      'field_name' => 
      array (
        0 => 
        array (
          'value' => '',
        ),
      ),
    ),
...
    'default_value' => 
    array (
      0 => 
      array (
        'value' => '',
      ),
    ),

Just delete one ('default_value') and should be working fine.

karens’s picture

Status: Needs review » Closed (duplicate)