Ajax request return field without name attribute Instead of getting multiselect on making ajax request while I select content type, I got single select and this select hasn't any name (select tag hasn't attribute name). So here's problem and I don't know how to fix it. Can anybody help?

$form['export_what'] = array(
    '#type'  =&gt; 'select',
    '#multiple' =&gt; FALSE,
    '#title' =&gt; t('Select content type'),
    '#required' =&gt; TRUE,
    '#options' =&gt; $form['export_what1_options']['#value'],
    '#ajax'    =&gt; array(
        'callback' =&gt; 'insttance_ajax_fill_content',
        'wrapper' =&gt; 'replace_model_div',
        'effect' =&gt; 'fade',
        'event'  =&gt; 'change',
    ),
);


$form['export_data'] = array(
    '#type' =&gt; 'select',
    '#multiple' =&gt; TRUE,
    '#required' =&gt; TRUE,
    '#default_value' =&gt; '',
    '#prefix' =&gt; '&lt;div id="replace_model_div"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
    '#options' =&gt; $content,
);


function insttance_ajax_fill_content($form, $form_state)
{
    $i = $form['count_field']['#value'];
    $content = getAllContentByType($form_state['values']['export_what']);

    $form['export_data'] = array(        
        '#type' =&gt; 'select',
        '#multiple' =&gt; TRUE,
        '#required' =&gt; TRUE,
        '#default_value' =&gt; '',
        '#prefix' =&gt; '&lt;div id="replace_model_div"&gt;',
        '#suffix' =&gt; '&lt;/div&gt;',
        '#options' =&gt; $content,
    );

    return $form['export_data'];
}
The attribute name is missing because you have replaced the select element in ajax callback. You just need to update the #options

function insttance_ajax_fill_content($form, $form_state)
{
    $i = $form['count_field']['#value'];
    $content = getAllContentByType($form_state['values']['export_what']);

    $form['export_data']['#options'] = $content;

    return $form['export_data'];
}