ZF-10661: Zend_View_Helper_FormSelect should not render label attribute

Issue Type: Improvement Created: 2010-11-09T01:19:42.000+0000 Last Updated: 2013-01-08T08:21:25.000+0000 Status: Resolved Fix version(s): - 1.12.2 (25/Feb/13)

Reporter: Erwin Derksen (erwind) Assignee: Frank Brückner (frosch) Tags: - Zend_View

  • FixForZF1.12.1
  • zf-crteam-priority

Related issues: Attachments: - FormSelect.php.patch


I've been wondering for a time why the label attribute gets rendered on option tags in a select tag. Diving into some html sources it looks like only IE 6+ implements it, but does nothing with it:

Sources: - -

So, to me it looks like a waste of performance and bandwidth to render it at all. I think that if it would be removed, nobody will miss it. Though it could of course be made optional (via passing in a pseudo attribute?)


Posted by Frank Brückner (frosch) on 2012-05-09T17:08:24.000+0000

The HTML standard says: {quote}label = text [CS] This attribute allows authors to specify a shorter label for an option than the content of the OPTION element. When specified, user agents should use the value of this attribute rather than the content of the OPTION element as the option label.{quote}…

We have no options for a shorter label. At the moment the label is used for the label attribute and as content for the option element. Conclusion: We can remove the label attribute.

Posted by Frank Brückner (frosch) on 2012-05-09T17:10:18.000+0000

Patch and unit test added.

Posted by Frank Brückner (frosch) on 2012-06-15T14:34:58.000+0000

Fix: "\n" to PHP_EOL

Posted by Frank Brückner (frosch) on 2013-01-08T08:21:25.000+0000

Fixed on trunk (25186) and release-1.12 (25187)

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.