Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.9.5
-
Fix Version/s: 1.10.0
-
Component/s: Zend_Validate
-
Labels:None
Description
When adding a validator to a form, it seems impossible to use the opposite of a validator.
Use Case: Having a form validator that does check if some value does not occur in an array. Want to use the 'not' InArray validator. Zend_Form will call isValid() and we can't use the opposite value of the boolean.
Adriaan Graas
This is not possible with a generic solution.
The problem is, that when something is "valid" it does not mean that it can simply be made "not valid". See Regex for example: Just because a regex returns true, it is not said that it also works the other way.
Or take an CreditCard number. The check if a credit card is valid uses multiple validations. They are run part by part and only the sum of all checks gives the result.
On the other side, what should be returned when a validation is true (false). This would negotate the complete message logic.
I see such a behaviour problematic.