How to set #default_value for radio button on Ajax Callback? I've a form having a radios and 'select list with Ajax callback event'. When user changed selection from the select box, I tried to set the default_value for radio button. but it doesn't work.

In the function check() I'm able to get the changed $id value every time I change the select list, but the default_value not working. it's always checked to the value 1 ('Yes').

I've tried like following but not working.

/**
 * Form.
 */
function myform($form, &amp;$form_state) {
    $current_items = array(1=&gt; 'Yes',2 =&gt; 'No');
    $form['current_items'] = array(
      '#title' =&gt; t('Change value'),
      '#type' =&gt; 'select',
      '#options' =&gt; $current_items,
      '#ajax' =&gt; array(
        'callback' =&gt; 'ajax_change_callback',
        'wrapper' =&gt; 'change-div',
      ),
    );
    $form['change_fieldset'] = array(
      '#prefix' =&gt; '&lt;div id="change-div"&gt;',
      '#suffix' =&gt; '&lt;/div&gt;',
      '#type' =&gt; 'fieldset',
    );

    if (!empty($form_state['values']['current_items'])) {
      $form['change_fieldset']['checkin_form'] = check($form_state['values']['current_items']);
    }
    else {
      $form['change_fieldset']['checkin_form'] = check(1);
    }

  return $form;
}

/**
 * Form callback.
 */
function ajax_change_callback($form, $form_state) {
  return $form['change_fieldset'];
}

/**
 * Callback Form.
 */
function check($id) {
    $items = array(1 =&gt; 'Yes', 2 =&gt; 'No');
    $form['checkin'] = array(
      '#title' =&gt; $id,
      '#type' =&gt; 'radios',
      '#options' =&gt; $items,
      '#default_value' =&gt; $id,
    );
    return $form;
}
Please check if this works

$commands[] = ajax_command_invoke('#my-radio-button-id', 'val', array(array('checked' =&gt; TRUE)));


Ref: http://handsomedogstudio.com/setting-radio-button-values-drupal-ajax-call