-- Codiac <[EMAIL PROTECTED]> wrote
(on Wednesday, 30 January 2008, 02:09 AM -0800):
> Thanks for your reply on this subject, I was wondering how to do it for some
> time now. 
> 
> However, I don't understand yet what you mean by setting a default value?
> Could you elaborate a bit more on your reply? Perhaps with a bit of code?
> 
> The HTML select element value is the literal value that will be displayed on
> screen, but how can that be used to set an element as selected?

    $select->setMultiOptions(array(
        'foo'   => 'Foo',
        'bar'   => 'Bar',
        'baz'   => 'Baz'
    ));
    $select->setValue('bar');

When rendered, the above should show 'Bar' as the selected item.

> Matthew Weier O'Phinney-3 wrote:
> > -- Jurriën Stutterheim <[EMAIL PROTECTED]> wrote
> > (on Tuesday, 29 January 2008, 08:28 PM +0100):
> >> Is it possible to specify which items in a <select> list will be selected 
> >> when using a Zend_Form_Element_Select element?
> > 
> > By default, it uses the value of the element to determine which item is
> > selected. If you want a particular item highlighted by default, set a
> > default value for the element.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to