开发者

Zend Framework: Change color of Zend Validation message

开发者 https://www.devze.com 2023-03-20 01:12 出处:网络
Is there a way to change to color of the message after Zend validation? This is my code right now: 开发者_开发百科$name = $this->createElement(\'text\', \'name\');

Is there a way to change to color of the message after Zend validation?

This is my code right now:

     开发者_开发百科   $name = $this->createElement('text', 'name');
    $name->setLabel('Name:')
            ->setAttrib('size', 50)->addValidator('StringLength', false,array(2,30))
                            ->addValidator($validator)

The $validator checks if the first letter is a capital letter.

Could I add some code to make the Validation text red? So if it is filled incorrectly, the message is in red color?

Thanks in advance!


Zend validation error messages draws like..

<ul class="errors">
<li>Error Message 1</li>
<li>Error Message 2</li>
<li>Error Message 3</li>
</ul>

So declare a class in css for ul.errors and specify color for that.


Some decorators allows you to configure them and set options :

$name->getDecorator('Errors')->setOption('class', 'custom_form_errors');

.custom_form_errors {
    list-style: none;
    ....
}

(I answer a bit late but since I was wondering the same question...)


Declare a class in css called ul.errors

ul.errors {
    color: color_code;
}
0

精彩评论

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