I have examined Zend Framework: Zend_Validate_Db_RecordExists and Zend_Validate_Db_NoRecordExists, and observed that you can check columns in a database table to see if the value in your form appears in a named column.
I have also observed that you can exclude a row based on the value of another column in the same row.
Is it possible to validate that a password matches a username using these validators?
So far, in my form, if a user inputs a correct username and a correct password (but not neccessarily the password for this username!) the form validates the input. Obviously for a login form or a username/token activation form, the token or password must match the username in the same row!
Thanks.
$this->addElement('text', 'handle', array(
'label' => 'Username:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
array(
'NotEmpty', true, array('messages' => 'You must enter your username.')
),
array(
'Db_RecordExists',
false,
array (
'member_activation',
'member_username'
)
)
)
));
$this->addElement('text', 'validationCode', array(
'label' => 'Code:',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(
array(
'NotEmpty', true, array('messages' => 'You must enter your validation code.')
),
array(
'Db_RecordExists',
false,
array (
'member_activation',
'member_validationcode'
)
)
)
));