Hi, I have my code for a dynamic dropdown, but while I've put the '#default_value' => '', am still getting a value as my first option, while I want it to be empty.

$form['Dropdown1'] = array(
    '#type' => 'select',    
    '#title' => 'Dropdown list (1)',
    '#options' => form_get_fields($selected),
    '#default_value' =>  '',   
    '#multiple' => FALSE,
    '#prefix' => '<div id="DD1">',
    '#suffix' => '</div>',
  );

Any fix for this?

Comments

Jaypan’s picture

I suspect that there is no option with an empty value that can be defaulted to.

lordrt21’s picture

I managed to do it, since in my function form_get_fields, am returning an array, and thus using something like
$myarray[''] = '', I got the first value as empty, and then my dynamic values