开发者

How do I set the text of an element within a Zend_Form decorator

开发者 https://www.devze.com 2023-03-05 09:13 出处:网络
I am trying to set the text inside the lengend tag within the following code: $element->setDecorators(array(

I am trying to set the text inside the lengend tag within the following code:

    $element->setDecorators(array(
        'ViewHelper',
        'Description',
        'Errors',
        array(array('legend' => 'HtmlTag'), array('tag' => 'legend', 'placement' => 'prepend')),
        array(array('fieldset' => 'HtmlTag'), array('tag' => 'fieldset')),
    ));

The following is generated:

    <fieldset>
    <legend></legend>
    </fieldset>

and I would like:

    <fieldset>
    <legend>Blah</legend>
    </fieldset>

Any help would be appreciated!

Update:

Using Regis's answer, I implemented this like so:

    $decorator = new Zend_Form_Decorat开发者_Go百科or_Fieldset();
    $decorator->setLegend("legend");

    $element->setDecorators(array(
        'ViewHelper',
        'Description',
        'Errors',
        array($decorator),
        array(array('div' => 'HtmlTag'), array('tag' => 'div')),
    ));        


you can try in this different way:

$decorator = new Zend_Form_Decorator_Fieldset();
$decorator->setLegend("legend");        
$element->addDecorators(array($decorator));
0

精彩评论

暂无评论...
验证码 换一张
取 消