Question

I'm using ZendFramework 1.11 and Zfdatagrid 0.8.

I've created a grid and a CRUD-form using my own db-model as source. Then I added some extra elements to the CRUD-form like this:

$element = new Zend_Form_Element('element', array('label'=>'new element:')); $grid->getForm(1)->addElement($element);

The new element is added to the form properly, but whereas all other form elements are within a table, the added element is placed as a list element above the actual form. Instead of this, i would like to have the added element as a part of the table to achieve a proper look of the form. Has anybody faced this issue before or an idea of how to do it? Any help is appreciated!

Thanks in advance!

Was it helpful?

Solution

 $elementDecorators = array(
            'ViewHelper',
            'Errors',
            array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
            array('Label', array('tag' => 'td', 'class' => 'form_label')),
            array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
        );

$this->_grid->getForm(1)->addElement('select', 'group', array(
            'required' => true,
            'value' => 'rtrt',
            'label' => 'Group',
            'multiOptions' => $list_contactgroup,
            'order' => 5, 'decorators' => $elementDecorators
        ));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top