How to ajax changing date field on _node_form? On content type called Order have 2 fields - "Category name" (term reference) and "Date" (Date (Unix timestamp)). On node edit form I want to change date to other value (for test purpose it is "hard coded", see code below) on changing "Category name".
Ajax fire on "Category name" and "Date" fieldset "fade" but date value still no change.

Code:

function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {  
  if ($form_id == 'order_node_form') {
    // Date (Unix timestamp)
    $form['field_date']['#prefix'] = '&lt;div id="field-date-replace"&gt;';
    $form['field_date']['#suffix'] = '&lt;/div&gt;';

    // Taxonomy reference select list
    $form['field_category_name']['und']['#ajax'] = array(
      'callback' =&gt; 'category_name_callback',
      'wrapper' =&gt; 'field-date-replace',
      'method' =&gt; 'replace',
      'effect' =&gt; 'fade',
    );

    if (!empty($form_state['field_category_name']['und'][0]['tid'])) {
      $form['field_date']['und'][0]['#default_value']['value'] = strtotime('12/12/2013 00:00:00');
    }

    // Test - work if uncommented
    //$form['field_date']['und'][0]['#default_value']['value'] = strtotime('10/10/2013 00:00:00');
  }
}

function category_name_callback(&amp;$form, &amp;$form_state) {
  // don't work too
  //return $form['field_date'];

  return array(
    '#type' =&gt; 'ajax',
    '#commands' =&gt; array(
      ajax_command_replace("#field-date-replace", render($form['field_date'])),
    ),
  );
}
I found a solution but not why, if someone knows and says I will mark as the correct answer.
Phone type behaves similarly to the decision to date and it is the same.

First of all this was hard to debug. For this I add in ajax callback the line

ajax_command_prepend("#field-date-replace", theme_status_messages(dpm($form_state)), 'status'),


And now all code

function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {  
  if ($form_id == 'order_node_form') {
    // Date (Unix timestamp)
    $form['field_date']['#prefix'] = '&lt;div id="field-date-replace"&gt;';
    $form['field_date']['#suffix'] = '&lt;/div&gt;';

    // simple text line input
    $form['field_some_text']['#prefix'] = '&lt;div id="field-some-text-replace"&gt;';
    $form['field_some_text']['#suffix'] = '&lt;/div&gt;';

    // Phone number module field
    $form['field_phone']['#prefix'] = '&lt;div id="field-phone-replace"&gt;';
    $form['field_phone']['#suffix'] = '&lt;/div&gt;';

    // Taxonomy reference select list
    $form['field_category_name']['und']['#ajax'] = array(
      'callback' =&gt; 'category_name_callback_func',
      'wrapper' =&gt; 'field-some-text-replace',
      'method' =&gt; 'replace',
      'effect' =&gt; 'fade',
    );

    if (!empty($form_state['values']['field_category_name']['und'][0]['tid'])) {
      $form['field_some_text']['und'][0]['value']['#value'] = 'after change';
    }
    else {
      $form['field_some_text']['und'][0]['value']['#value'] = 'before change';
    }

  }
}

/**
 * AJAX callback for 'field_category_name' form 
 */
function category_name_callback_func($form, $form_state) {

  if (!empty($form_state['values']['field_category_name']['und'][0]['tid'])) {
    $form['field_phone']['und'][0]['number']['#value'] = '999999';
    $form['field_phone']['und'][0]['country_codes']['#value'] = 'gb';

    $form['field_date']['und'][0]['value']['date']['#value'] = '01/01/2014';
  }
  else {
    $form['field_phone']['und'][0]['number']['#value'] = '';
    $form['field_phone']['und'][0]['country_codes']['#value'] = '';
  }

  return array(
    '#type' =&gt; 'ajax',
    '#commands' =&gt; array(
      ajax_command_replace("#field-date-replace", render($form['field_date'])),
      ajax_command_replace("#field-some-text-replace", render($form['field_some_text'])),
      ajax_command_replace("#field-phone-replace", render($form['field_phone'])),

      // remove comment (//) on next line for debuging
      //ajax_command_prepend("#field-date-replace", theme_status_messages(dpm($form_state)), 'status'),
    ),
  );
}


The difference between all the examples I've seen, and this decision is that the values ​​change is made in "ajax callback" but not in hook_form_alter.