Matthew Weier O'Phinney-3 wrote:
> 
> -- 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/
> 
> 


Dang!
as simply as that :)
Thank you Matthew.

Well, is there a room to ask another question? or should i open a new topic?
I need to add hidden text area bellow multiselect, and if you select third
choice, this hidden box should appear visible.
How to set up something like this?
Thanks a lot,
Vladd

p.s. [off topic] about zend dojo webinar- can u post a link to my mail or
here pls?
-- 
View this message in context: 
http://www.nabble.com/How-to-add-select%3Dselected-in-Zend_Form_Element_Multiselect-tp19166233p19167409.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to