ZF-6170: [trunk] Zend_View_Helper_FormSelect additional attributs per option

Issue Type: Improvement Created: 2009-03-31T06:13:57.000+0000 Last Updated: 2009-03-31T06:35:52.000+0000 Status: Resolved Fix version(s): Reporter: Ben R. (salzig) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: Attachments:


There is no option to give an single element an html attribute, i.e. class for layouting.

In my situation i tried to create an select with default option, and i would like to add some html attributes to it, i.e. class.


Posted by Matthew Weier O'Phinney (matthew) on 2009-03-31T06:35:35.000+0000

formSelect()'s third argument, $attribs, let's you do precisely this:

<pre class="highlight">
echo $this->formSelect('foo', '', array('class' => 'foobar'), $options);

which will set the 'class' attribute of the select to 'foobar'.

You cannot set the class for individual options within the select, but that's an edge case we really cannot support.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.