[support] Setting Multiselect Default Values

Shawn Webb lattera at gmail.com
Thu Jan 12 22:18:15 UTC 2012


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


More information about the support mailing list