View Single Post
  #1 (permalink)  
Old 03-14-2008, 02:32 AM
kmg kmg is offline
Junior Member
 
Join Date: Mar 2008
Posts: 9
Default Zend_Validate_Identical not working.

I can't get Zend_Validate_Identical to work. It just always says "No token was provided to match against", no matter what.

PHP Code:

        $form
->addElement('text''first'
            array(
                
'required'    => true,
                
'label'        => 'First Name',
                
'validators'    => array(
                    
'alnum',
                    array(
'StringLength'503),
                    array(
'regex'false'/^[a-zA-Z]/i'),
                    array(
'Identical''test')
                    ),
                )
            ); 
So what's the deal?

Also, I need to compare one form field to another form field (password to confirm password), and the easiest way I could think while following the validation model was to write a custom validator, something like Zend_Validate_IdenticalToField that would just take in a form element, and call it's getValue method for comparison. Is there some better way this could be implemented within the Zend_Form / Zend_Validate pattern? Also, what about a UniqueInModelField validator that checks against a model for any existing entries that would conflict, like for a unique email address? These are probably outside of the scope of Zend_Validate by quite a bit though. What do you guys think?
Reply With Quote