Setting
'#default_value' => array('SERVER01','SERVER02')
Is the correct form.
You cannot as you have done pass the results of a DB_QUERY directly to the '#default_value'.
Hope that helps.
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Shawn Webb Sent: Thursday, January 12, 2012 2:18 PM To: support@drupal.org Subject: [support] Setting Multiselect Default Values
Hey Fellow Drupalers,
I'm trying to set the '#default_value' property to a select form element that has '#multiple' set to TRUE. Below you will find a link to the source and a link to a screenshot. I've tried setting '#default_value' to:
[values] array('SERVER01') array('SERVER01' => 'SERVER01') array(1) array('1') 1 'SERVER01' [/values]
But nothing sets the default value of the select form element. The '#options' element is set to (verbatim from var_export): array ( 'SERVER01' => 'SERVER01', 'SERVER02' => 'SERVER02', 'SERVER03' => 'SERVER03', 'SERVER04' => 'SERVER04', 'SERVER05' => 'SERVER05', )
Links: Screenshot: http://t.co/vVAcT4fA Code: https://t.co/ETl4MtgV
The code in question is line 105 of vulnscan.admin.inc
Let me know what I should do. I'm running drupal 7.11-dev (git checkout of Drupal codebase, set to the 7.x branch).
Thanks,
Shawn