-- Philip G <[email protected]> wrote (on Wednesday, 15 April 2009, 12:13 PM -0500): > ha. That's your solution for everything. Write your own! :p > > Alright. I'll look at these things in more detail later down the line. For > now, > I found a solution that I can use to whip out this form (it's in side a day, > fully functional) and little time to research too much. :( > > In the future, I hope to. > > For the time being, I found a solution of just stripping out the label and > form > decorator entirely and leaving only the ViewHelpers and Errors. This allows us > to "decorate" it through standard HTML (eg: our web devs) while keeping the > error handling and error printing for form fields. I think this is actually a > good optimal solution that works when our webdev and appdev are separate > departments.
The third post in that series, about "rendering individual decorators" directly addresses this pattern of development. I've had a lot of feedback on that particular post -- I think you'll find it a useful read. > On Wed, Apr 15, 2009 at 11:40 AM, Matthew Weier O'Phinney <[email protected]> > wrote: > > -- 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/ > > -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/
