« Return to Thread: Zend_Form

Re: Zend_Form

by Simon Corless :: Rate this Message:

Reply to Author | View in Thread

I'm trying to disable and reset the decorators on my form but the following does nothing!

If I remove disableLoadDefaultDecorators' => true and the line $form->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div')), 'Form')); then the form displays as normal (i.e. dd tags). If I add disableLoadDefaultDecorators' => true, then as expected, nothing shows at all. Therefore I added in the form decorators at the bottom and it displays the form as normal again.

$form = new Zend_Form(array('disableLoadDefaultDecorators' => true, 'elementDecorators' => array(
                'ViewHelper',
                array('Description', array('tag' => 'div', 'class' => 'help')),
                'Errors',
                array('Label'),
                array('HtmlTag', array('tag' => 'div', 'class' => 'field'))
               
            )));
            $form->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div')), 'Form'));

Is this remotely the right way to replace the default decorators or am I better off extending the form class outeright?

How do I pass the decorators I wish to use for the form to the constructor? I couldn't see this in the setOptions method.

Your help would be greatly appreciated as I can't believe it is as hard as I am finding it!

Simon

 « Return to Thread: Zend_Form