Sorry some how my previous email lost all the newlines in code,
On 10/14/07 7:26 PM, "Nayana Hettiarachchi" <[EMAIL PROTECTED]> wrote: > Hi, > > I have written a custom validate Class > > class StringEqual extends Zend_Validate_Abstract > { > const NOT_EQUAL = "string"; > > protected $_messageTemplates = array(self::NOT_EQUAL => "'%value%' > Missmatched value"); > > public function isValid ($value) > { > $this->_setValue($value['password']); > > if ($value['password'] !== $value['password2']) { > $this->_error(self::NOT_EQUAL); > return false; > } > > return true; > } > } > > The validation works ok, but I never get the right error message, the error > message array always contains > > Here is how I am using the above class > > $validators = array( > "username" => array("NotEmpty", "Alpha", 'presence' => > 'required'), > "password" => array("NotEmpty", "Alpha", "presence" => 'required', > new StringEqual(), "fields" => array("password", > "password2")) > ); > > $validator = new Zend_Filter_Input($filters, $validators, $data); > > > When the StringEqual validation class fails in the errors it says Array ( > [password] => Array ( [0] => string ) ) I can't seem to get the actual error > message to show up. > > Maybe I am not doing something right, any help is greatly appreciated. > > Also I am not sure how to set 2 Values in the $_templateMessage > > I also tried doing the following and it also didn¹t work, > > $this->_createMessage(self::NOT_EQUAL, $value['password'] . " Not Equal to " > . $value['password2']); > Before the call to _error(); > > > > Regards > Nayana -- Nayana Hettiarachchi <[EMAIL PROTECTED]> Director, Technology GMI Technologic Direct: +1 206 315 9319 Cell: +1 206 713 5759 Integrated solutions for market research www.gmi-mr.com Sent using the Microsoft Entourage 2004 for Mac Test Drive.