At the moment, two empty rows are created for data entry when 'unlimited' is selected for 'Number of values'.

I think it's counter intuitive to create two rows, when in many cases only one row will be required - is there a way I can change the default to one row?

Comments

lukus’s picture

See this answer for a solution:

http://drupal.stackexchange.com/questions/10481/unlimited-values-field-h...

/**
 * Implements hook_form_BASE_FORM_ID_alter().
 */
function MYMODULE_form_node_form_alter(&$form, &$form_state, $form_id) {
  $field_name = 'field_YOURFIELD';

  if (empty($form[$field_name])) {
    return;
  }

  $field_language = $form[$field_name]['#language'];
  $max_delta = $form[$field_name][$field_language]['#max_delta'];
  unset($form[$field_name][$field_language][$max_delta]);
}
kristofferwiklund’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

This problem is not in field collection table. The root of the problem is the core module field collection. And in the latest version you can not set a default value on the field collection field on the node. You can have default values on each of the fields inside the field collection, so that will be added when a new row is added.

In order to have custom default values, you have to use the hook_form_alter and do the logic.