Hi all!
I don't know if it's wanted or not, but I was pretty confused by this
behavior.
// In the controller add an error to the element of a form
$form->captcha->addErrors(array("Inserire i caratteri corretti"));
// Checking if it's marked as invalid
echo $form->captcha->hasErrors(); // output -> 1
$form->isValid($formData);
// After the isValid call the element is not marked as invalid anymore
echo $form->captcha->hasErrors(); // output -> 0
This was a problem in an if statement because it returned true even if the
second element was false
if($form->isValid($formData) && !$form->captcha->hasErrors())
Swapping the elements it works
if(!$form->captcha->hasErrors() && $form->isValid($formData))
I know that probably the right thing to do is to use custom validators, but
I'm still learning and maybe someone could find this info useful.
Dario
--
View this message in context:
http://www.nabble.com/Zend-Form-isValid%28%29---custom-errors-tp18729453p18729453.html
Sent from the Zend Framework mailing list archive at Nabble.com.