Why is my Drupal ajax form not populating the radio buttons I have a form which send an ajax request to my server. The form is:     

function dokimi_add_to_list_form($form, $form_state) {


  $form = array();


  $options=array(
      'option1'=&gt;'option1',
      'option2'=&gt;'option2'

  );

  $form['private_list'] = array(
    '#type' =&gt; 'radios',
    '#title' =&gt; 'Private lists',
    '#options' =&gt; $options,
    '#prefix'=&gt;'&lt;div id="list_list"&gt;',
    '#suffix'=&gt;'&lt;/div&gt;'
  );

  $form['add_new']= array(
    '#type' =&gt; 'fieldset',
    '#markup' =&gt; 'Add a list'
  );

  $form['add_new']['new_list']= array(
    '#type' =&gt; 'textfield',
    '#title'=&gt; 'New list',
    '#default_value' =&gt; '',
  );

  $form['add_new']['add']= array(
    '#type' =&gt; 'button',
    '#value' =&gt; t('Add'),
            '#ajax'=&gt;array(
              'callback' =&gt; 'add_to_list_callback',
              'wrapper'=&gt;'list_list'
                  // 'wrapper' is the HTML id of the page element that will be replaced.
        )
      );

 return $form;
}


And the callback function is:

function add_to_list_callback($form, $form_state){

    $options=array(
      'newoption1'=&gt;'newoption1',
      'newoption2'=&gt;'newoption2',
      'newoption3'=&gt;'newoption3'      
  );
    $form['private_list'] = array(
        '#type' =&gt; 'radios',
        '#title' =&gt; 'Private list',
        '#options' =&gt; $options,
        '#prefix'=&gt;'&lt;div id="list_list"&gt;',
        '#suffix'=&gt;'&lt;/div&gt;'
  );

    $commands = array();
    $commands[]=ajax_command_replace('#list_list', render($form['private_list']));
    return array(
        '#type'=&gt;'ajax',
        '#commands'=&gt;$commands
    );

}


When the 'Add' button is clicked, a new array of options should be returned, but I get an empty list instead.

The form is rendered in a ctools modal if that is of importance.

Thanks for any help with this - it's driving me barmy.
I think you need to reorganize your code.
First you need two ['Private_list'] at the same function Form and at this same function form you need to declare the array variables for each private list.

$list1_options = array(......);
$list2_options = array(.......);


['Private_list1´]: these are the first choice the user need to do: here you use the ajax call back.

['Private list2']: these one have the choices the user need to pick according to the first selection on ['Private_list1´]: at this 'Private_list2' you use the wrapper prefix and suffix.

the ajax call back function should only look something like this most of the times: 

function example_change_callback($form, &amp;$form_state) {
  return $form['private_list2'];
}


Your basicly using the call back to identify wich form you need to update on event change.

I recommend you study this drupal dependent ajax example, dispate the example is using dropdown list, you should be able to aply it to radio buttons, just follow the same structure.

I hope i was hepfull, tell us later how it went...
Have a good coding!