-- vladimirn <[EMAIL PROTECTED]> wrote
(on Tuesday, 26 August 2008, 10:29 AM -0700):
> I was searching all over but failed to find a way to add selected=selected
> into multiselect.
> My code is like this:
> [code]
> $listOptions=(array(
> 'first' => 'first choice',
> 'second' => 'second choice',
> 'third' => 'third choice'
> );
>
> $lists = new Zend_Form_SubForm();
> $lists->addElements(array(
> new Zend_Form_Element_Multiselect('nameOfMultiselect',array(
> 'label' => 'Select all you can apply',
Add a value. Multiselect expects an array of keys that should be
selected:
'value' => array('second'),
> 'required' =>true,
> 'filters' =>array('StringTrim'),
> 'multiOptions' => $listOptions,
>
> 'validators' => array(
> array('InArray', false, array(array_keys($listOptions)))
> )
> ))
> ));
> [/code]
>
> I would like to have selected second choice when multiselect display.
> How this can be done?
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/