Hi all. I have a strange problem with the select element of a Zend_Form.
My code is this:
$this->getElement('macro')
->addMultioption(array_keys($arr),array_values($arr))
->setRequired(true)
->addDecorator('HtmlTag',array('tag' => 'div', 'class' =>
'dec_macro'))
;
where array_keys($arr) return:
and
*array*
0 => int 8
1 => int 24
2 => int 15
3 => int 11
4 => int 12
5 => int 1
and array_values($arr) return:
*array*
0 => string 'Abbigliamento e Accessori' /(length=25)/
1 => string 'Affari e Industria' /(length=18)/
2 => string 'Animali' /(length=7)/
3 => string 'Arte e Antiquariato' /(length=19)/
4 => string 'Audio, TV e Foto' /(length=16)/
5 => string 'Auto e Accessori' /(length=16)/
But the rendered form is :
<select name="macro" id="field_macro" class="field_macro">
<optgroup label="Array">
<option value="0" label="Abbigliamento e Accessori">Abbigliamento e
Accessori</option>
<option value="1" label="Affari e Industria">Affari e Industria</option>
<option value="2" label="Animali">Animali</option>
<option value="3" label="Arte e Antiquariato">Arte e Antiquariato</option>
<option value="4" label="Audio, TV e Foto">Audio, TV e Foto</option>
<option value="5" label="Auto e Accessori">Auto e Accessori</option>
Why this ?
Tnx.
--
Michel 'ZioBudda' Morelli [email protected]
Consulenza sistemistica in ambito OpenSource.
Sviluppo applicazioni web dinamiche (LAMP+Ajax)
Telefono: 0200619074
Telefono Cell: +39-3939890025 -- Fax: +39-0291390660
http://www.ziobudda.net ICQ: 58351764
http://www.ziobuddalabs.it Skype: zio_budda
http://www.ajaxblog.it MSN: [email protected]
JABBER: [email protected]