ZF-2824: There is a serious need to change how Zend_Form handles populating multioption elements when creating form from config
Description
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
array(1) {
["multiOptions"]=>
array(3) {
[0]=>
array(2) {
["val"]=>
string(1) "1"
["key"]=>
string(2) "aa"
}
[1]=>
array(2) {
["key"]=>
string(1) "2"
["val"]=>
string(4) "xxxx"
}
[2]=>
array(2) {
["val"]=>
string(3) "444"
["key"]=>
string(4) "ssss"
}
}
}
That way we can store our configuration in XML and generate options with text values as well.
Comments
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:
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.
Generates this (formatted for readability):