Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-09-2008, 02:27 PM
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 03:04 PM
Member
 
Join Date: Mar 2007
Posts: 34
Default

Zend Framework: Documentation
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 06:01 AM
Junior Member
 
Join Date: Mar 2008
Posts: 8
Default

You should check the Password Validator code, i had similar problem i was looking at it in validator part, but the problem was with Password Validator class.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 07:30 AM
Junior Member
 
Join Date: Apr 2008
Posts: 28
Default

Wow thanks, I didn't realise the code was already written. I tried looking for a password validator and googled it and it didn't really come up with anything. It works now


thanks guys =)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:36 PM.