Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By lordrt21 on
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
I suspect that there is no
I suspect that there is no option with an empty value that can be defaulted to.
I managed to do it, since in
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