<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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.<br>
<br>
Jeff<br>
<br>
<br>
On 4/30/2010 5:20 PM, Randy Fay wrote:
<blockquote
cite="mid:p2v15c957091004301420yf9fd6545n20cb4bf34216cf89@mail.gmail.com"
type="cite">I find no problems with this code...<br>
<br>
<span style="font-family: courier new,monospace;">function
form_default_some_form() {</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> $default = '';</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> $options =
array('' => 'none', 'a' => 'a', 'b' => 'b');</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">
$form['myform']['mytypes'][$key] = array(</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> '#type' =>
'select',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> '#title' =>
'Example select',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> '#options' =>
$options,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> '#default_value'
=> $default,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> );</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> return $form;</span><br
style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">}</span><br>
<br>
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.)<br>
<br>
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.<br>
<br>
</blockquote>
<br>
</body>
</html>