Right now, I have Zend form elements wrapped in list-items. Form is validating or coughing up errors as it should. But I'd like to apply a class to the list-items of offending elements (but only to the list-items offending elements) on failed validation. Example:
This field has valid input
<li>
<input type="text" name="address2" id="address2" value="" size="25">
</li>
but this one does not
<li class="error">
<input type="text" name="address2" id="address2" value="" size="25">
</li>
The only way I can see to do this is to extend Zend_Form_Element, and override isValid() and then extend all classes derived from Zend_Form_Element I need for my form(s).
There has got to be a better way.
Right?
What am I missing?
THANKS