So why doesn't it work when I even set it manually to any of the values I posted in the original email? Those values are the exact same as what you just said to do.

Sent from my Android device. please forgive any spelling or grammatical errors.

On Jan 12, 2012 4:38 PM, "Metzler, David" <metzlerd@evergreen.edu> wrote:

I think it’s premature to file a bug.  I verified the correct behavior in my drupal 7 innstance.  #multiple does work correctly.   I had initially looked at the wrong procedure, so I got misled by the return of a closely named procedure.

 

Change line 91 to read:

 

$servers[] = $record->servername;

 

 

Also you can add  before the return

drupal_set_message(print_r($servers,1));

 

just as you return $servers so that you can verify that you’re getting the data back correctly.

 

 

Finally I couldn’t help but notice that gatt_all_servers_assoc is getting data  $record->name, but at 91, you’re pulling $record->servername.   Is this in error?


Dave

 

 

 

 

 


From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Shawn Webb
Sent: Thursday, January 12, 2012 3:05 PM
To: support@drupal.org
Subject: Re: [support] Setting Multiselect Default Values

 

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.

I also understand that I should run the submitted values through array_filter.  That's not the issue.

Let me know if or how I should file a bug report.

Thanks,

Shawn

Sent from my Android device. please forgive any spelling or grammatical errors.

On Jan 12, 2012 3:48 PM, "Metzler, David" <metzlerd@evergreen.edu> wrote:

PS.

IT's important to know that what you get back in your submit handler for
$formstate['values']['new_server']is an array of all of the servers and
wheter they are selected.  In the case where SERVER01 and SERVER02 are
selected you'll get back the array:

Array(
 'SERVER01' => 'SERVER01',
 'SERVER02' => 'SERVER02',
 'SERVER03' => 0,
 'SERVER04' => 0,
 'SERVER05' => 0
);


You will not get back string data as your code seems to be expecting.

Dave



-----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
--
[ Drupal support list | http://lists.drupal.org/ ]
--
[ Drupal support list | http://lists.drupal.org/ ]


--
[ Drupal support list | http://lists.drupal.org/ ]