How can I initialize Zend_Form_Element_Select with a config array?
-
01-07-2019 - |
Question
I tried:
$form->addElement(
'select',
'salutation',
array(
'required' => true,
'options' => array(
'Mr.' => 'Mr.',
'Mrs.' => 'Mrs.',
'Ms.' => 'Ms.',
),
)
);
Then I print_r()
ed the form, and options for salutation are empty. Does anybody know the correct spell for that? As far as I see, there's no documentation for Zend element configs' format.
Solution
You should use 'multiOptions' instead of 'options'.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow