Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #0.0
Musa.thomasadd informations
Comment #1
donutdan4114 CreditAttribution: donutdan4114 commentedI have run into this same issue.
When returning a
select
form element,#multiple => TRUE
is ignored.