I want to make a form with a password field. I want to compare the password field with a constant. Is it possible to do with addValidator()
?
$this->addElement( $this->createElement ( 'password', 'password' )
->setAttrib('class','fld')
->setLabel ( 'Slaptažodis: ' )
->addValidator('Identical',
false,
array('token' => 'value')
));
try something like this:
$constantHere = '123';
$this->addElement( $this->createElement ( 'password', 'password' )
->setAttrib('class','fld')
->setLabel ( 'Slaptažodis: ' )
->addValidator('Identical',
false,
$constantHere));
you only use Array with TOKEN when u wanna compare with another element, if you wanna compare with constant u need use directly in the last argument.
see more here: zend doc