The example you sent back is correct, though it wouldn't prove itself
with $default = '' ... the problem was that the text for default=null
was the only value that -did- show. $default would need to be set = to
one of the other values to prove out otherwise. That said, it does, and
was indeed the browser <large sigh and chuckle>. Thanks, Randy.
Jeff
On 4/30/2010 5:20 PM, Randy Fay wrote:
I find no problems with this code...
function form_default_some_form() {
$default = '';
$options = array('' => 'none', 'a' => 'a', 'b' => 'b');
$form['myform']['mytypes'][$key] = array(
'#type' => 'select',
'#title' => 'Example select',
'#options' => $options,
'#default_value' => $default,
);
return $form;
}
It performs as expected on D6.16. I thought that the use of an empty
string for a key was screwy, but it doesn't seem to affect anything.
(But remember, that empty($string) will return TRUE where the string
has nothing in it, thus affecting lots of code you might not want to
affect.)
Be careful that you don't have your browser tricking you by
autofilling the form. Ctrl-refresh or Shift-refresh or clear the
cache. Try another browser.