2009年11月17日星期二

[fw-mvc] problem with zend_formElemend_Select

Hello overyone.

I'm trying to fill a  Zend_Form_Element_Select box with an array but it stays empty on the screen.
This is my code:

// create artist name text field
$artistNameElement = new Zend_Form_Element_Text('artistName');
$artistNameElement->setLabel("Artist name: ");
$genres = array("multiOptions" => array(
"electronic" =>"Electronic", 
"country" => "Country",
"rock" =>"Rock", 
"r_n_b" =>"R & B", 
"hip_hop" => "Hip-Hop",
"heavy_metal" =>"Heavy-Metal",
"alternative_rock" =>"Alternative Rock", 
"jazz" =>"Jazz", 
"pop" =>"Pop"
));
$genreElement = new Zend_Form_Element_Select('genre', $genres);
$genreElement->setLabel("Genre:");
$genreElement->setRequired(true);

What is going wrong?

Thanks,

j sanders

没有评论: