Hi everybody.

I'm freaking out here, because i just can't get the following working:

$form ['test'] = array(
  '#type' => 'select',
  '#title' => 'just testing',
  '#default_value' => array('foo'),
  '#options' => array(''=> 'default', 'foo' => 'foo', 'bar'=> 'bar'),
  '#multiple' => true
);

It displays the selection list, but there's nothing selected.
What the freaking heck am I missing?

Thanks a million,
Doik

Comments

grobemo’s picture

I'm not sure, but I don't think you need an array as the value of #default_value. Try:

  '#default_value' => 'foo',
Doik’s picture

Hey David,

thanks for the reply.
It still doesn't change anything though.
I tried all of the following lines:

  '#default_value' => 'foo',
  '#default_value' => array('foo'),
  '#default_value' => array('foo' => 'foo'),
  '#default_value' => array('foo', 'bar'),

nothing worked, and i'm really stumped. because it should (imho).

any ideas?

thanks, Doik

grobemo’s picture

I'm stumped, too, then. Have you tried looking at it with Form Inspect? Maybe that will reveal something.

Anybody else have any bright ideas?

Doik’s picture

Thanks for the hint, didn't know about that module.
If anyone else has some idea, i'd be glad, otherwise i'll install devel and form inspect this evening.
Thanks again, david
so long
Doik