Node add form alter & submit custom field I have a content type "event" with a field called "field_pricelist". It's a dropdown with no values, I add the values when I alter the form. The values come from a custom table (install / schema) in my database. I want to save this custom value on insert/update. My code works but I don't think it's the best way to save/update a custom field.. Any suggestions?

function TableManager_form_alter(&amp;$form, &amp;$form_state, $form_id){
if ($form_id == 'event_node_form') {

global $user;
$query = db_select('pricelist', 'p');
$query-&gt;fields('p');
$query-&gt;condition('user_id', $user-&gt;uid,'=');
$results = $query-&gt;execute()-&gt;fetchAll();

$query2 = db_select('field_data_field_pricelist', 'd');
$query2-&gt;fields('d');
$query2-&gt;condition('entity_id', $form['nid']['#value'],'=');
$results2 = $query2-&gt;execute()-&gt;fetchAll();

$dropdown_array = array();
foreach ($results as $r) {
    $form['field_pricelist']['und']['#options'][$r-&gt;pricelist_id] = $r-&gt;pricelist_name;
}
$form['field_pricelist']['und']['#default_value']['0'] = $results2['0']-&gt;field_pricelist_value;
$form['#submit'][] = "TableManager_form_submit";
}

}

function TableManager_form_submit($form, &amp;$form_state) {

global $user;

$nid = $form_state['values']['nid'];
$pricelist_id = $form_state['values']['field_pricelist']['und']['0']['value'];

$query = db_update('field_data_field_pricelist');// Table name no longer needs {}
$query-&gt;fields(array('field_pricelist_value' =&gt; $pricelist_id));
$query-&gt;condition('entity_id', $nid, '=');
$query-&gt;execute();
}
Try this...

function TableManager_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  if ($form_id == 'event_node_form') {

    global $user;
    $query = db_select('pricelist', 'p');
    $query-&gt;fields('p', array('pricelist_id', 'pricelist_name'));
    $query-&gt;condition('user_id', $user-&gt;uid);
    $results = $query-&gt;execute()-&gt;FetchAllKeyed(0,1);

    $results['_none'] = "-Select-";

    $query2 = db_select('field_data_field_pricelist', 'd');
    $query2-&gt;fields('d', array('field_pricelist_value'));
    $query2-&gt;condition('entity_id', $form['nid']['#value']);
    $results2 = $query2-&gt;execute()-&gt;fetchField();

    if(empty($results2)) {
      $results2['_none']="-Select-";
    }

    $form['field_pricelist'][LANGUAGE_NONE]['#options'] = $results;
    $form['field_pricelist'][LANGUAGE_NONE]['#default_value'] = $results2;

   // $form['#submit'][] = "TableManager_form_submit";  // No longer need of this function

  }

}