<p>I understand. However, I'm not setting the default value directly from db_query. I'm setting it as you suggested, but I'm not seeing the correct result. That is the issue. Even though I'm setting it as everyone has suggested, I'm still not seeing them selected by default. </p>
<p>I also understand that I should run the submitted values through array_filter. That's not the issue. </p>
<p>Let me know if or how I should file a bug report. </p>
<p>Thanks, </p>
<p>Shawn </p>
<p>Sent from my Android device. please forgive any spelling or grammatical errors.</p>
<div class="gmail_quote">On Jan 12, 2012 3:48 PM, "Metzler, David" <<a href="mailto:metzlerd@evergreen.edu">metzlerd@evergreen.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
PS.<br>
<br>
IT's important to know that what you get back in your submit handler for<br>
$formstate['values']['new_server']is an array of all of the servers and<br>
wheter they are selected. In the case where SERVER01 and SERVER02 are<br>
selected you'll get back the array:<br>
<br>
Array(<br>
'SERVER01' => 'SERVER01',<br>
'SERVER02' => 'SERVER02',<br>
'SERVER03' => 0,<br>
'SERVER04' => 0,<br>
'SERVER05' => 0<br>
);<br>
<br>
You will not get back string data as your code seems to be expecting.<br>
<br>
Dave<br>
<br>
<br>
<br>
-----Original Message-----<br>
From: <a href="mailto:support-bounces@drupal.org">support-bounces@drupal.org</a> [mailto:<a href="mailto:support-bounces@drupal.org">support-bounces@drupal.org</a>] On<br>
Behalf Of Shawn Webb<br>
Sent: Thursday, January 12, 2012 2:18 PM<br>
To: <a href="mailto:support@drupal.org">support@drupal.org</a><br>
Subject: [support] Setting Multiselect Default Values<br>
<br>
Hey Fellow Drupalers,<br>
<br>
I'm trying to set the '#default_value' property to a select form<br>
element that has '#multiple' set to TRUE. Below you will find a link<br>
to the source and a link to a screenshot. I've tried setting<br>
'#default_value' to:<br>
<br>
[values]<br>
array('SERVER01')<br>
array('SERVER01' => 'SERVER01')<br>
array(1)<br>
array('1')<br>
1<br>
'SERVER01'<br>
[/values]<br>
<br>
But nothing sets the default value of the select form element. The<br>
'#options' element is set to (verbatim from var_export): array (<br>
'SERVER01' => 'SERVER01', 'SERVER02' => 'SERVER02', 'SERVER03' =><br>
'SERVER03', 'SERVER04' => 'SERVER04', 'SERVER05' => 'SERVER05', )<br>
<br>
Links:<br>
Screenshot: <a href="http://t.co/vVAcT4fA" target="_blank">http://t.co/vVAcT4fA</a><br>
Code: <a href="https://t.co/ETl4MtgV" target="_blank">https://t.co/ETl4MtgV</a><br>
<br>
The code in question is line 105 of vulnscan.admin.inc<br>
<br>
Let me know what I should do. I'm running drupal 7.11-dev (git<br>
checkout of Drupal codebase, set to the 7.x branch).<br>
<br>
Thanks,<br>
<br>
Shawn<br>
--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br>
</blockquote></div>