You can't use Identical validator without required
because in the isValid()
method of Zend_Form_Element
there is :
if ((('' === $value) || (null === $value))
&& !$this->isRequired()
&& $this->getAllowEmpty()
) {
return true;
}
and Zend_Form_Element_Password
is an instance of Zend_Form_Element
.
I think you have 3 possibilities:
- Add
required
option in yourconfirm
element, but you have a specific message required - Add
allowEmpty
option to false in yourconfirm
element like this :'allowEmpty' => false,
instead of'required' => false,
- Create your own validator like the Cully Larson's answer. An other example it's the
example #3
of the documentation about Writing validators. Otherwise, you can find more on the web. :)