Zend Form Validation: Is there a validator that is the opposite of Identical (i.e., notIdentical)? How would I check that an input is not identical to 'str'?
Asked
Active
Viewed 1,506 times
1 Answers
6
AFAIK there is not something like NotIdentical. Have you tried your own validator in that way?:
class My_Validate_NotIdentical extends Zend_Validate_Identical
{
public function isValid($value)
{
return !parent::isValid($value);
}
}
It just simplest solution - you should also change validation messages etc.

Radek Benkel
- 8,278
- 3
- 32
- 41
-
cool! thanks. I don't like zend endless class inheritance that making application very slow, php not compilied language like java/#c - should be also way to do inline validation.Zend not offer this option. example how can inline works: addValidate(true,empty(value)); , but zend not support that option – Ben Jan 30 '11 at 12:17
-
Err.. how do we override the validation message? – Amree Feb 12 '11 at 09:13
-
Override protected `_messageTemplates` property of `Zend_Validate_Abstract`. But they use constants, so I could be kinda confusing, when message with const `NOT_SAME` gives you 'Strings are the same!' :) In another case, you should override whole `isValid` method (or write validator class by yourself). – Radek Benkel Feb 12 '11 at 20:05