views:

49

answers:

1

Hi, 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!

A: 
    $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'));
Vladimir
Vladimir thank you :), but it insert divs between label and input field, but I need to insert it as usual, after input field.Now it: <LABEL><DIVS><INPUT>, I need: <LABEL><INPUT>DIV> but it's ok for now. Also, divs should be in your code in reverse order. The main question now is why divs are always visible, even if no errors? Thank you for patients and for your help!