Question

I need to wrap zend form error messages in custom html.

<div class="cerror" id="ID-error">
    <div class="ui-widget">
        <div class="ui-state-error ui-corner-all" id="IDerror-msg">
            %ZEND_FORM_ERROR_MESSAGE%
        </div>
    </div>
</div>

Now I get errors in format:

<ul>
    <li>Error message</li>
</ul>

I need:

<div class="cerror" id="EMAIL-error">
    <div class="ui-widget">
        <div class="ui-state-error ui-corner-all" id="EMAIL-error-msg">
            <ul>
                <li>Error message</li>
            </ul>
        </div>
    </div>
</div>

Thank you!

I have following code:

        $element->clearDecorators();
        $element->removeDecorator('DtDdWrapper');
        $element->addDecorator('ViewHelper');
        $element->addDecorator('Description', array('tag' => 'p', 'class' => 'description'));
        $element->addDecorator('Label', array('tag' => null));
        $element->addDecorator(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-line'));

How to wrap errors in 3 div tags? Thank!

Was it helpful?

Solution

    $element->clearDecorators();
    $element->addDecorator('Errors');
    $element->addDecorator(array('div1' => 'HtmlTag'), array('tag' => 'div',
                    'class' => 'cerror', 'id' => 'EMAIL-error'));
    $element->addDecorator(array('div2' => 'HtmlTag'), array('tag' => 'div',
                    'class' => 'ui-widget'));
    $element->addDecorator(array('div3' => 'HtmlTag'), array('tag' => 'div',
                    'class' => 'ui-state-error ui-corner-all',
                    'id' => 'EMAIL-error-msg'));
    $element->addDecorator('ViewHelper');
    $element->addDecorator('Description', array('tag' => 'p', 'class' => 'description'));
    $element->addDecorator('Label', array('tag' => null));
    $element->addDecorator(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-line'));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top