If I put #ajax callback wich is replace div by an select form multiple, all is ok but the select is not multiple
Here my code:
The form

  $form['fieldset'] ['fieldset_select']  ['fields_exist'] = array (
      '#type' => 'select',
      '#multiple'=>true,
      '#disabled' => true,
      '#title' => t('Champs existants'),
      '#description' => t('Sélectionner et '),
      '#prefix' => '<div id="replace_field_exist">',
      '#suffix' => '</div>',
  );
  
  $form ['fieldset'] ['table'] = array (
    '#type' => 'textfield', 
    '#title' => t('Table à chercher'), 
    '#suffix' => t('Pour les options ci-desous'), 
    '#required' => true 
  );
  $form ['fieldset'] ['search_field'] = array (
    '#type' => 'button', 
    '#title' => t('Table à chercher'), 
      '#value'=> t('Table à chercher'), 
      '#ajax'=>array(
          'callback'=>'ooti_openerp_search_field_table',
         
     'wrapper' => 'replace_field_exist')
  );

The ajax callback

 if($tab_fields!==false )
 {
   foreach($tab_fields as $name_field=>$field)
   {
     $options[]=$name_field;
   }
 }
 $form['fieldset'] ['fieldset_select']  ['fields_exist'] = array (
  '#type' => 'select',
      '#multiple'=>true,
     '#title' => t('Champs existants'),
     '#options' => $options,
      '#prefix' => '<div id="replace_field_exist">',
      '#suffix' => '</div>',
 );

 dsm($form); 
  $form_state ['rebuild'] = TRUE;
  return  $form['fieldset'] ['fieldset_select']  ['fields_exist'];

Comments

Musa.thomas’s picture

Issue summary: View changes

add informations

donutdan4114’s picture

Title: #multiple not work with #ajax callback » #multiple does not work when using #ajax callback
Version: 7.22 » 7.28

I have run into this same issue.
When returning a select form element, #multiple => TRUE is ignored.

Version: 7.28 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.