Am Samstag, 5. Juni 2010, um 07:49:30 schrieb merrix:
> Hi and thanks in advanced,
>
> I've noticed when using a Display Group that I get markup like so:
>
>
> <dt> </dt>
> <dd>...</dd>
>
>
> I've tracked this behavior down to Zend_Form_Decorator_DtDdWrapper. Here's
> the culprit:
>
>
> ...
> $dtLabel = $this->getOption('dtLabel');
> if( null === $dtLabel ) {
> $dtLabel = ' ';
> }
> return '<dt id="' . $elementName . '-label">' . $dtLabel . '</dt>'
> . '<dd id="' . $elementName . '-element">' . $content . '</dd>';
>
>
> The question is, how do I supply the $dtLabel when calling
> $form->addDisplayGroup or better yet when passing in a form as Zend_Config?
> Preferably, I would like to avoid configuring the decorator every time I
> call a display group if that makes sense.
>
> Thanks again.
Many ways lead to the expected:
1.
new Zend_Form(array(
'displayGroupDecorators' => array(
'FormElements',
array('HtmlTag' => array('tag' => 'dl')),
'Fieldset',
array('DtDdWrapper' => array('dtLabel' => 'new Label'))));
2.
$form->addDisplayGroup($elements, 'nameOfDisplayGroup',
array('decorators' => array(
'FormElements',
array('HtmlTag' => array('tag' => 'dl')),
'Fieldset',
array('DtDdWrapper' => array('dtLabel' => 'new Label')))));
3.
Extend Zend_Form_DisplayGroup and configure
the Decorators within the init() method
to show a few.
Greetings, Christian
--
/**
* Zend_Form Lead
* http://twitter.com/c_alb
*/