-- Philip G <[email protected]> wrote
(on Wednesday, 15 April 2009, 10:45 AM -0500):
> I'm looking at the examples at http://devzone.zend.com/article/
> 3450-Decorators-with-Zend_Form
> In there, it shows a decorator setup to use table rows for each element. This
> is almost what I need:
>
> $element->setDecorators(array(
> 'ViewHelper',
> 'Errors',
> array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' =>
> 'element')),
> array('Label', array('tag' => 'td'),
> array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
> ));
>
> However, I need one addition, "class=formLabel" within the label's <td> cell.
> But, if I add 'class' => 'formLabel' to the Label line eg:
>
> array('Label', array('tag' => 'td', 'class' => 'formElement')),
>
> it puts it on the <label> tag, not the <td> tag I specifically told to wrap it
> in.
>
> What I'm getting:
> <td><label for="name" class="formElement required">Name</label></td>
>
> What I need:
> <td class="formElement"><label for="name" class="required">Name</label></td>
>
> Is there any simple way to do this?
Write your own decorator. :)
You may want to check out my recent postings on Zend_Form decorators:
http://weierophinney.net/matthew/plugin/tag/decorators
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/