Custom field not saving updates I've created a widget which has two textfields and a hidden uniqid. One of these fields is for the name of an item, the other is the number of people who can be involved in that item. These save without any problem, and they re-populate on the edit page correctly, but if I change the values, they do not update correctly.

I am not a Drupal expert, so I am uncertain how much code will be required for diagnosis. These seem to be the most relevant parts, but there is a volunteers_field_is_empty, volunteers_field_validate, volunteers_schema, and a volunteers_field_formatter_view, as well as empty volunteers_field_insert, volunteers_field_formatter_prepare_view, and volunteers_preprocess_node.

function volunteers_field_info() {
  $t = get_t();
  $fields = array();
  $fields['volunteers_item'] = array(
    'label' =&gt; $t('Volunteer item'),
    'description' =&gt; $t('A position for volunteers'),
    'default_widget' =&gt; 'volunteers_field_widget',
    'default_formatter' =&gt; 'volunteer',
    'settings' =&gt; array('length' =&gt; 255)

  );
  return $fields;
}

function volunteers_field_widget_info() {
  $t = get_t();
  return array(
    'volunteers_field_widget' =&gt; array(
      'label' =&gt; $t('Volunteers widget'),
      'field types' =&gt; array('volunteers_item'),
      'settings' =&gt; array(),
      'behaviors' =&gt; array(
        'default value' =&gt; FIELD_BEHAVIOR_NONE
      )
    )
  );
}

function volunteers_field_schema($field) {
  $schema = array();
  switch($field['type']) {
    case 'volunteers_item':
      $schema['columns'] = array(
        'position_title' =&gt; array (
          'type' =&gt; 'varchar',
          'length' =&gt; 255,
          'not null' =&gt; TRUE
        ),
        'position_count' =&gt; array (
          'type' =&gt; 'int', 
          'sortable' =&gt; TRUE,
          'default' =&gt; 1,
          'unsigned' =&gt; TRUE
        ),
        'unique_id' =&gt; array(
          'type' =&gt; 'varchar',
          'length' =&gt; 255,
          'not null' =&gt; TRUE
        )
      );
      break;
  }
  return $schema;
}


function volunteers_field_widget_form_alter(&amp;$element, &amp;$form_state, $context) {
  $type = $context['field']['type'];
  $lang = $context['langcode'];
  $delta = $context['delta'];
  if($type == 'volunteers_item' &amp;&amp; isset($context['items'][$delta])) {
    $item = $context['items'][$delta];
    $element['position_title']['#value'] = $item['position_title'];
    $element['position_count']['#value'] = $item['position_count'];
    $element['unique_id']['#value'] = $item['unique_id'];
  }
}


function volunteers_field_widget_form(&amp;$form, &amp;$form_state, $field, $instance, 
  $lang, $items, $delta, $element) {

  $t = get_t();
  $type = $instance['widget']['type'];
  switch ($type) {
    case 'volunteer_field_widget':
    case 'volunteers_field_widget':
      $element['position_title'] = array(
        '#type' =&gt; 'textfield',
        '#length' =&gt; 255,
        '#title' =&gt; $t('Position name'),
        '#weight' =&gt; 0,
        '#delta' =&gt; $delta,
        '#size' =&gt; 'big'
      );

      $element['position_count'] = array(
        '#type' =&gt; 'textfield',
        '#weight' =&gt; 1,
        '#length' =&gt; 10,
        '#delta' =&gt; $delta + 1,
        '#title' =&gt; $t('Number of participants'),
      );

      $element['unique_id'] = array(
        '#type' =&gt; 'hidden',
      );
      break;
  }

  return $element;
}

function volunteers_field_presave($entity_type, $entity, $field, $instance, $langcode, &amp;$items) {
  if($field['type'] == 'volunteers_item'){
    foreach($items as &amp;$item) {
      // setting default values. 
      $count = $item['position_count'];
      if(!$count) $count = 1;
      $item['position_count'] = $count;
      if(!isset($item['unique_id'])) {
        $item['unique_id'] = uniqid(rand(),1);
      }
    }
  }
}
The problem is with volunteers_field_widget_form and volunteers_field_widget_form_alter. volunteers_field_widget_form_alter was preventing updates. If I set the default_value of the relevant elements appropriately in volunteers_field_widget_form, Drupal both allows updates and displays correctly.

$element['position_title'] = array(
  '#type' =&gt; 'textfield',
  '#length' =&gt; 255,
  '#title' =&gt; $t('Position name'),
  '#default_value' =&gt; isset($items[$delta]['position_title']) ? $items[$delta]['position_title'] : null,
  '#weight' =&gt; 0,
  '#delta' =&gt; $delta,
  '#size' =&gt; 'big'
);