View Single Post
  #1 (permalink)  
Old 04-09-2008, 02:27 PM
Filip Filip is offline
Junior Member
 
Join Date: Apr 2008
Posts: 28
Default Validator Issue with Zend Form

Hello,

I'm writing a register page and I need to verify wether the password in fieldA & fieldB are identical. Everything else with validators works smoothly. I just can't manage to get these to work.

I can always take the easy way out and compare the 2 values outside of the form. But then there'd be 1 error message showing somewhere else except nexto the field where the error is.

My form is in a PhPclass I call in my other page

here's the password fields with their validators

Code:
                  
 	$wachtwoordA = new Zend_Form_Element_Password('wachtwoordA');
 		$wachtwoordA    ->setLabel('Password')
 					->setRequired(true)
 					->addFilter('StringTrim')
 					->addValidator($LeegValidate,true)
 					->addValidator($lengthControl["8-20"]);

 					
 	$wachtwoordB = new Zend_Form_Element_Password('wachtwoordB');
 	$wachtwoordB  ->setLabel('Retype password')
 				->setRequired(true)
 				->addFilter('StringTrim')
 				->addValidator($LeegValidate,true)
 				->addValidator($lengthControl["8-20"])
 				->addValidator(new Artec_validators_PwValidator(array(
                           1 => $this->getValue("wachtwoordA"),
                            2 => $this->getValue('wachtwoordB'))
                          );
the Artec_validators_pwValidator has the following isValid($value) method.
Atm I'm just echo'ing them to see if it sends through the right data
Code:
   public function isValid($value)
    {
    	echo $value[1] . '<br>';
    	echo $value[2];
  //  	echo $value['3'];
    	exit;
the echo gives me the following output
Code:
b
c
in the password fields I typed twice 'azertyuiop' (without the " ' ").

Can anybody help me solve this?
Reply With Quote