Details
Description
Zend_Form_Element::addError() has the following description: "Add an error message and mark element as failed validation". This implies that Zend_Form_Element::addError() also sets the element to fail validation. The method Zend_Form_Element::addErrorMessage() on the other hand has the following description: "Add a custom error message to return in the event of failed validation" Which seems to be a more accurate description of what Zend_Form_Element::addError() actually does.
On another note, Zend_Form::addError() has the same description with the word "element" in them, which makes the matter even more confusing.
Also, Zend_Form_Element::addError() calls Zend_Form_Element::markAsError() which has the following description: "Mark the element as being in a failed validation state".
This leads me to believe that addError() was meant to actually make validation fail, but that doesn't seem to be the case.
Does anyone have a workaround for this issue for the present? The best I could make up was to make isValid in Form check to see if _errorsExist was true; if so, valid is set to false, else _errorsExist set to !valid. Otherwise there doesn't seem to be a check that would make sure that a user-set error (called by formObject->setError() and ->markAsError()) was noted. I haven't tested this with "regular" use cases, but I don't see why it shouldn't work unless someone sets the error state of the form independently (as we are trying to do).