How to add a specific class to an input which has generated a form error?

Posted by Kamil Mroczek on Stack Overflow See other posts from Stack Overflow or by Kamil Mroczek
Published on 2010-03-24T16:49:06Z Indexed on 2010/03/24 16:53 UTC
Read the original article Hit count: 225

Filed under:
|

I want to add a specific class to an input if an error is genereted by the input.

For example, if input is empty and has required validator it shouls look like this:

<dd id="login-element">
    <input type="text" name="login" id="login" value="" class="input-text error" />
    <ul class="errors">
        <li>Value is required and can't be empty</li>
    </ul>
</dd>

class="input-text error"

Please tell me how to do that.

© Stack Overflow or respective owner

Related posts about zend-framework

Related posts about zend-form