i am adding elements dynamically using data from a database

so i did something like 

$this->addDisplayGroup(array('item'), "labAllocation", array(
    'legend' => 'Lab Allocation'
));

foreach ($labs as $lab) {
    $this->getDisplayGroup("labAllocation")->addElement(new
Zend_Form_Element_Text("lab-" . $lab->id, array(
        'label' => $lab->name,
        'decorators' => array(
            'ViewHelper',
            'label',
            array('decorator' => array('p' => 'HtmlTag'), 'options' =>
array('tag' => 'p'))
        )
    )), "lab-" . $lab->id);
}

is this the right way can i do something like

$this->getDisplayGroup("labAllocation")->addElements($arr)?

trying to add Zend_Form_Elements to $arr then add it using addElements seem
to give an error probably becos the array shld be of names of the elements
-- 
View this message in context: 
http://www.nabble.com/Adding-elements-to-Display-Group-tp23381633p23381633.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to