(on Thursday, 16 July 2009, 02:47 PM -0500):
> I believe this feature works only within the scope of a single element
> validation. I may be misunderstanding how it works, but I believe it means that
> if the first validation fails, it stops validating and outputs only the first
> validation error message.
It means that if the given validator fails, it will not process any
validators occurring after it in the chain.
> What I am looking for is a way to break out of all form validation if an
> element fails. If several fields have validators set, and the first field fails
> its check, then I'd like the $form->isValid($data) to exit the validation loop
> that takes it through the remaining elements. I don't see a way to do this
> within the functions provided in ZF unless I am missing something. Am I missing
> something?
Zend_Form does not allow for this; it attempts to validate all elements,
so that you can return all possible validation errors for all elements
back to the user.
You could likely write a validator that you insert at the top of each
element that checks the parent form for any failed element validations
and skips validation -- but it would mark that element as failed in
validation as well.
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论