In multigroup default value showed only in 1st record

1. Install Content Construction Kit (CCK) 6.x-3.0-alpha1
2. Create content type test123 (see code below)
3. Start create new content with type test123
4. In multigroup 'Test group' field 'Test group URL' contain default value 'http://www.example.com/'
5. Press button 'Add more values'. Field 'Test group URL' is blank.

$content['type']  = array (
  'name' => 'Test123',
  'type' => 'test123',
  'description' => '',
  'title_label' => 'Title',
  'body_label' => 'Body',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => true,
    'sticky' => false,
    'revision' => false,
  ),
  'show_preview_changes' => true,
  'show_diff_inline' => false,
  'enable_revisions_page' => true,
  'old_type' => 'test123',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'comment' => '2',
  'comment_default_mode' => '4',
  'comment_default_order' => '1',
  'comment_default_per_page' => '50',
  'comment_controls' => '3',
  'comment_anonymous' => 0,
  'comment_subject_field' => '1',
  'comment_preview' => '1',
  'comment_form_location' => '0',
);
$content['groups']  = array (
  0 => 
  array (
    'label' => 'Test group',
    'group_type' => 'multigroup',
    'settings' => 
    array (
      'form' => 
      array (
        'style' => 'fieldset',
        'description' => '',
      ),
      'display' => 
      array (
        'description' => '',
        'teaser' => 
        array (
          'format' => 'fieldset',
          'exclude' => 0,
        ),
        'full' => 
        array (
          'format' => 'fieldset',
          'exclude' => 0,
        ),
        4 => 
        array (
          'format' => 'fieldset',
          'exclude' => 0,
        ),
        2 => 
        array (
          'format' => 'fieldset',
          'exclude' => 0,
        ),
        3 => 
        array (
          'format' => 'fieldset',
          'exclude' => 0,
        ),
        'token' => 
        array (
          'format' => 'fieldset',
          'exclude' => 0,
        ),
        'label' => 'above',
      ),
      'multigroup' => 
      array (
        'subgroup' => 
        array (
          'weight' => -20,
          4 => 
          array (
            'format' => 'table-multiple',
            'exclude' => 0,
          ),
        ),
        'multiple-columns' => 0,
        'required' => 0,
        'multiple' => 1,
        'labels' => 
        array (
          0 => '',
          1 => '',
          2 => '',
          3 => '',
          4 => '',
          5 => '',
          6 => '',
          7 => '',
          8 => '',
          9 => '',
        ),
      ),
    ),
    'weight' => '14',
    'group_name' => 'group_test',
    'parent' => '',
  ),
);
$content['fields']  = array (
  0 => 
  array (
    'label' => 'Test name',
    'field_name' => 'field_test_name',
    'type' => 'text',
    'widget_type' => 'text_textfield',
    'change' => 'Change basic information',
    'weight' => '3',
    'rows' => 5,
    'size' => '60',
    'description' => '',
    'default_value' => 
    array (
      0 => 
      array (
        'value' => '',
        '_error_element' => 'default_value_widget][field_test_name][0][value',
      ),
    ),
    'default_value_php' => '',
    'default_value_widget' => NULL,
    'group' => false,
    'required' => 0,
    'multiple' => '0',
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'op' => 'Save field settings',
    'module' => 'text',
    'widget_module' => 'text',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'text',
        'size' => 'big',
        'not null' => false,
        'sortable' => true,
        'views' => true,
      ),
    ),
    'display_settings' => 
    array (
      'weight' => '3',
      'parent' => '',
      4 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      2 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      3 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
  ),
  1 => 
  array (
    'label' => 'Test group ID',
    'field_name' => 'field_test_group_id',
    'type' => 'number_decimal',
    'widget_type' => 'number',
    'change' => 'Change basic information',
    'weight' => '17',
    'description' => '',
    'default_value' => 
    array (
      0 => 
      array (
        'value' => '',
        '_error_element' => 'default_value_widget][field_test_group_id][0][value',
      ),
    ),
    'default_value_php' => '',
    'default_value_widget' => 
    array (
      'field_test_group_id' => 
      array (
        0 => 
        array (
          'value' => '',
          '_error_element' => 'default_value_widget][field_test_group_id][0][value',
        ),
      ),
    ),
    'group' => 'group_test',
    'required' => 0,
    'multiple' => 1,
    'min' => '',
    'max' => '',
    'precision' => '10',
    'scale' => '2',
    'decimal' => '.',
    'prefix' => '',
    'suffix' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'op' => 'Save field settings',
    'module' => 'number',
    'widget_module' => 'number',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'numeric',
        'precision' => '10',
        'scale' => '2',
        'not null' => false,
        'sortable' => true,
      ),
    ),
    'display_settings' => 
    array (
      'weight' => '17',
      'parent' => 'group_test',
      4 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      2 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      3 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
  ),
  2 => 
  array (
    'label' => 'Test group name',
    'field_name' => 'field_test_group_name',
    'type' => 'text',
    'widget_type' => 'text_textfield',
    'change' => 'Change basic information',
    'weight' => '18',
    'rows' => 5,
    'size' => '60',
    'description' => '',
    'default_value' => 
    array (
      0 => 
      array (
        'value' => '',
        '_error_element' => 'default_value_widget][field_test_group_name][0][value',
      ),
    ),
    'default_value_php' => '',
    'default_value_widget' => 
    array (
      'field_test_group_name' => 
      array (
        0 => 
        array (
          'value' => '',
          '_error_element' => 'default_value_widget][field_test_group_name][0][value',
        ),
      ),
    ),
    'group' => 'group_test',
    'required' => 0,
    'multiple' => 1,
    'text_processing' => '0',
    'max_length' => '',
    'allowed_values' => '',
    'allowed_values_php' => '',
    'op' => 'Save field settings',
    'module' => 'text',
    'widget_module' => 'text',
    'columns' => 
    array (
      'value' => 
      array (
        'type' => 'text',
        'size' => 'big',
        'not null' => false,
        'sortable' => true,
        'views' => true,
      ),
    ),
    'display_settings' => 
    array (
      'weight' => '18',
      'parent' => 'group_test',
      4 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'label' => 
      array (
        'format' => 'above',
      ),
      'teaser' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      2 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      3 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
  ),
  3 => 
  array (
    'label' => 'Test group URL',
    'field_name' => 'field_test_group_url',
    'type' => 'link',
    'widget_type' => 'link',
    'change' => 'Change basic information',
    'weight' => '19',
    'description' => '',
    'default_value' => 
    array (
      0 => 
      array (
        'url' => 'http://www.example.com/',
      ),
    ),
    'default_value_php' => '',
    'default_value_widget' => 
    array (
      'field_test_group_url' => 
      array (
        0 => 
        array (
          'url' => 'http://www.example.com/',
        ),
      ),
    ),
    'group' => 'group_test',
    'required' => 0,
    'multiple' => 1,
    'validate_url' => 1,
    'url' => 0,
    'title' => 'none',
    'title_value' => '',
    'enable_tokens' => 0,
    'display' => 
    array (
      'url_cutoff' => '80',
    ),
    'attributes' => 
    array (
      'target' => 'default',
      'rel' => '',
      'class' => '',
      'title' => '',
    ),
    'op' => 'Save field settings',
    'module' => 'link',
    'widget_module' => 'link',
    'columns' => 
    array (
      'url' => 
      array (
        'type' => 'varchar',
        'length' => 2048,
        'not null' => false,
        'sortable' => true,
      ),
      'title' => 
      array (
        'type' => 'varchar',
        'length' => 255,
        'not null' => false,
        'sortable' => true,
      ),
      'attributes' => 
      array (
        'type' => 'text',
        'size' => 'medium',
        'not null' => false,
      ),
    ),
    'display_settings' => 
    array (
      'label' => 
      array (
        'format' => 'above',
        'exclude' => 0,
      ),
      'teaser' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'full' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      4 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      2 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      3 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
  ),
);
$content['extra']  = array (
  'title' => '4',
  'body_field' => '6',
  'revision_information' => '8',
  'author' => '7',
  'options' => '9',
  'comment_settings' => '10',
  'menu' => '5',
  'path' => '11',
);

Comments

sergmain’s picture

I've just checked how validation work for other record (2nd, 3th, ...) and see that validation work only for 1st record in multigroup.

jcfiala’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for the heads up - I hadn't heard anything about CCK alpha 3.x branch. Is there any documentation of changes modules have to do to be compliant with the new branch?

sergmain’s picture

Sorry, I just only a user of drupal :)

May be KarenS (http://drupal.org/user/45874) can help you. He fixed my bug report very quickly today.

jozzhart’s picture

Hello,

I'm having the same issue with 6.x-3.0-alpha3

Default value of a text field is only being set on first record. Ajax request when adding second group doesn't have the default value set.

Cheers,
Jozz

jozzhart’s picture

Status: Postponed (maintainer needs more info) » Active
jcfiala’s picture

Status: Active » Postponed (maintainer needs more info)

No, you can't just shift it to 'active'. I still need to know:

Thanks for the heads up - I hadn't heard anything about CCK alpha 3.x branch. Is there any documentation of changes modules have to do to be compliant with the new branch?

Or, feel free to work up a useful patch!

dqd’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)
Issue tags: +field validation

Dear followers of this issue: please read the project page info of link module for further validation issues. There is already an issue to collect and discuss all possible validation scenarios in general. That's why I will mark this one here as duplicate. I need all concentration inside the ONE and only discussion to move forward. After a D7 implementation we will provide a D6 backport.

Explanation: There are too many corner cases and validation wishes of users to implement them all serially one after the other. We would have a 40 lines cluttered settings form for validation methods, conflicting with each other randomly. I think, the right way is to find a maybe more complex but all embracing new configuration method, which lets the admin better decide, how and when to validate the url. Including a good description which helps to set it up. This will surely lead to a new branch