$this->_options = array(
array(
'value' => 'foo',
'label' => 'Foo 1'
),
array(
'value' => 'foo',
'label' => 'Foo 2'
),
/ etc. /
);
That would allow for what Yi Tang needs, and also allow for options with no value attribute by specifying null as the value. Of course any getters/setters would have to be modified to prevent breaking BC.
-Hector
On Mon, Nov 24, 2008 at 4:01 PM, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- Yi Tang <ytang@mbira.com> wrote
(on Monday, 24 November 2008, 04:24 PM -0600):
> I'm trying to add some options with the same value but different textsNot really. Both the view helper as well as the form element require you
> to a Zend_Form_Select element, looks like Zend_Form_Select by default
> removes all duplicate options. Is there anyway to get around this?
to pass an associative array of key/value pairs to create the options --
and PHP's associative arrays require unique keys. The only way to get
around it would be to create a custom view helper or decorator that
generates the markup.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论