I try to make a decorator for Zend_Form that will wrap a form in HTML-table:

$form = $this->getElement();

$form->setDecorators(array(
        new Zend_Form_Decorator_FormElements(),
        new Zend_Form_Decorator_HtmlTag(array('tag' => 'table')),
        new Zend_Form_Decorator_Form()
));

$form->setElementDecorators(array(
        new Zend_Form_Decorator_ViewHelper(),
        new Zend_Form_Decorator_Errors(),
        array(
                'decorator' => array('cell' => 'HtmlTag'),
                'options' => array('tag' => 'td')
        ),
        new Zend_Form_Decorator_Label(array('tag' => 'td')),
        array(
                array('row' => 'HtmlTag'),
                array('tag' => 'tr')
        )
));

I expect HTML-code like that:

<form ...>
        <table><tbody>
                <tr>
                        <td><label class="optional" 
for="employee">Employee:</label></td>
                        <td><input type="text" class="employee ac_input" 
value="" id="employee"
name="employee" autocomplete="off"/></td>
                </tr>
                <tr>
                        <td><label class="optional" for="employee">Task 
ID:</label></td>
                        <td><input type="text" class="task" value="" 
id="master-taskid"
name="master[taskid]"/></td>
                </tr>

                <tr>
                        <td align="center" colspan="2"><input type="submit" 
class="employee"
value="Ok" id="Ok" name="Ok"/></td>
                </tr>
        </tbody></table>
</form>

First i add my decorator. Then i add a submit button
(Zend_Form_Element_Submit) and hidden element (Zend_Form_Element_Hidden) to
a form. But this elements are rendered like text elements. What's wrong?
-- 
View this message in context: 
http://www.nabble.com/Wrong-work-of-custom-Zend_Form_Decorator-tp22537016p22537016.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to