Zend Framework 2: Select Optgroups

On my project I’m currently working on I needed to use optgroups. After looking high and low through the documentation and the code I discovered the feature kind of worked, but kind of didn’t. I issued a pull request that fixed the code for the next release (2.0.1) but here’s the skinny on how to set it up.

When setting the valueOptions attribute of a SelectElement specify an array as follows for optgroup support.

  • Mihai

    Hello,
    Can you please add the steps for populating the select with items from the database?
    Thanks!

  • http://www.brunoporto.com.br/ Bruno Porto

    I agree, really well