Don't have them right in front of me but I think you should only be using the 
open 'dl' tag. But I believe the goal you're aiming for is the default ZF 
decorator.

$textDecorators = array('ViewHelper', array(array('data' => 'HtmlTag'), 
array('tag' => 'dd')), array('Label', array('tag' => 'dt')), array('HtmlTag', 
array('tag' => 'dl')));

-Wil Revehl

-----Original Message-----
From: Mike Wright [mailto:[email protected]] 
Sent: Saturday, November 26, 2011 2:52 PM
To: Zend Framework
Subject: [fw-general] desperately need help with decorators

Hi all,

For all the Yanks out there, hope you had a great Thanksgiving Day.

Been fighting this for weeks and still don't get it.

What I'm trying to achieve is to wrap each form element in a <dl></dl> tag.  
After much experimenting I ended up with this:

public function setSubFormDecoratorsDl(Zend_Form_SubForm $subForm) {
     $subForm->setDecorators(
         array(
             array('FormElements',
                    array('separator' => "</dl><dl>"),),   <-------
             array('Form'),
             array('Fieldset'),
         )
     );
}

...trying to get the following:

<fieldset>
   <form>
     <dl>
       <dt><label/></dt>
       <dd><input/></dd>
     </dl>
     <dl>
       <dt><label/></dt>
       <dd><input/></dd>
     </dl>
   </form>
</fieldset>

...but end up with this:

<fieldset>
   <form>
     <dl></dl>    <----- extra, empty <dl/>
     <dl>
       <dt><label>...</label></dt>
       <dd><input/></dd>
     <dl>
     <dl>
       <dt><label>...</label></dt>
       <dd><input/></dd>
     <dl>
   </form>
</fieldset>

If I don't include the separator I end up with all of the FormElements inside 
*one* <dl/>.  e.g.

<dl>
   <dt/><dd>
   <dt/><dd>
</dl>

Definitely *not* what I want.

I can use css to hide the superfluous <dl/>, but if the wrapper tag is instead, 
e.g. <tr/> or <td/>, it destroys table layouts because of the extra row or 
column.

What is the correct way to decorate the FormElements so I don't inject an 
empty, extra tag?

I've lost a ton of time trying to figure this out but am afraid I'll drop dead 
before I get it ;/

Sign me "desperate".

Thanks for any and all help,
Mike Wright

--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]



--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to