First, use an associative array for your options list, which as you've already discovered is completely wrong in the code you sent out. <br>'#options' => array("orange" => t("orange"),... ) or '#options' => array('or' => t('Orange'))... or '#options' => array('1' => t('Orange'), ...)<br>
<br>Second, use only strings for the keys of the associative array (I've seen numeric keys cause some difficulty here in D7 at least)<br><br>You don't mention what version of Drupal you're working with.<br><br>
-Randy<br><br><div class="gmail_quote">On Fri, Apr 30, 2010 at 12:28 PM, Jeff Greenberg <span dir="ltr"><<a href="mailto:jeff@ayendesigns.com">jeff@ayendesigns.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Ignore the code in the first message. I've boiled down the problem to this: If the array of values I'm populating my select with is $myarray('apple','orange') and a select box should have 'orange' selected when I paint the form, '#default_value' => 'orange' or '#default_value' => 1, neither cause the value showing in the select to be other than the no-selection value.<div>
<div></div><div class="h5"><br>
<br>
On 4/30/2010 12:57 PM, Jeff Greenberg wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi. I have an admin settings form that contains an array of select fields. The problem is that when submitted, the values don't end up in the db and are the select fields go back to having no selected value. The form was working fine as checkboxes, but when the need arose for each label value to have multiple values to choose from (instead of on/off) and I made it an array of fields, as below, it stopped working.<br>
</blockquote>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Module and Site Development<br><a href="mailto:randy@randyfay.com">randy@randyfay.com</a><br>+1 970.462.7450<br><br>