To continue the conversation with myself: You can't pass an array(new Model_Validator_StringEquals, 'fields'=>array('password','db_password')) like I am trying to do below. So I guess the question is, how do you set multiple validators when one of them (but only one) needs a FIELDS metacommand?
On Wed, Mar 26, 2008 at 1:16 PM, David Mintz <[EMAIL PROTECTED]> wrote: > > For a change-my-password thing I want to validate the "current password" > field: not empty, and matching the value currently > stored in the database. I have a custom StringEquals validator pretty much > stolen from the example in the docs. It compares the submitted value to the > one in the db (there's no hashing of passwords in this instance) So: > > $validators = array( > 'password' => array( > 'NotEmpty', > array(new > Model_Validator_StringEquals,'fields'=>array('password','db_password')), > 'messages'=>array( > 'Password field is required', > 'Password is incorrect' > ), > 'breakChainOnFailure' => true > ) > ); > > results in: Object of class Model_Validator_StringEquals could not be > converted to string in [...]Zend/Filter/Input.php on line 908. However, > passing in a string instead of an object, thus > > $validators = array( > 'password' => array( > 'NotEmpty', > > array('Model_Validator_StringEquals','fields'=>array('password','db_password')), > 'messages'=>array( > 'Password field is required', > 'Password is incorrect' > ), > 'breakChainOnFailure' => true > ) > > results in Plugin by name Model_Validator_StringEquals was not found in > the registry > > Not that it does work in its own rule like so: > > $validators = array( > 'correctPassword'=>array( > new Model_Validator_StringEquals(), > //'Model_Validator_StringEquals' fails with "plugin > not found" > 'fields'=>array('db_password','password'), > 'messages'=>'Current password field is incorrect', > ), > ); > > but that isn't how I want to do it (-: . Any hints? > > Thanks > > > --- > David Mintz > http://davidmintz.org/ > > The subtle source is clear and bright > The tributary streams flow through the darkness -- David Mintz http://davidmintz.org/ The subtle source is clear and bright The tributary streams flow through the darkness