ZF-2824: There is a serious need to change how Zend_Form handles populating multioption elements when creating form from config

Issue Type: Improvement Created: 2008-03-07T08:50:34.000+0000 Last Updated: 2009-06-28T14:28:40.000+0000 Status: Resolved Fix version(s): - 1.5.1 (25/Mar/08)

Reporter: Marcin Lulek (ergo14) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Form

Related issues: Attachments:


In current implementation when creating lets say SELECT element, we need to pass the options as 'val'=>'text', with that approache we face a problem when we want to assign integer value to option. With current zend_config we would need to have in XML something like <1>type11>, this is illegal in xml - so we cant assign integer values to options, and i think that is the most common use case for select elements ( database normalization for inserting values etc. ).

I would suggest we have something that could accept a format like

<pre class="highlight"> 
array(1) {
  array(3) {
    array(2) {
      string(1) "1"
      string(2) "aa"
    array(2) {
      string(1) "2"
      string(4) "xxxx"
    array(2) {
      string(3) "444"
      string(4) "ssss"

That way we can store our configuration in XML and generate options with text values as well.


Posted by Matthew Weier O'Phinney (matthew) on 2008-03-21T13:34:23.000+0000

Resolved in trunk and release-1.5 branch. You can now specify formats like the following in your config files:

  • INI

      options.first.key = "aa"
      options.first.value = 1
      options.second.value = "xxxx"
      options.second.key = 2
      options.third.key = "ssss"
      options.third.value = 444
  • XML

  • PHP:

      $options = array(
              'value' => '1',
              'key'   => 'aa',
          array (
              'key'   => '2',
              'value' => 'xxxx',
          array (
              'value' => '444',
              'key'   => 'ssss',

Posted by George Cooksey (ssbg) on 2009-06-28T14:28:39.000+0000

I would suggest reopening this issue for the following reason: Short-hand xml configuration does not work.

<pre class="highlight">1Male

Generates this (formatted for readability):

<pre class="highlight">


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.