I have a user registration form with email field which acts as username and should be unique accross the application.
User model has following are validation rules for this field:
var $validate = array(
'email' => array(
'email' => array('rule' => 'email', 'allowEmpty' => false, 'last' => true, 'message' => 'Valid email address required'),
'unique' => array('rule'=> 'isUnique', 'message' => 'Already exists'),
),
);
In my controller I want to check if it was the 'unique' rule which has failed (to display a different form elements, like "Send password recovery email" button).
I can check whether email field was valid or not (if (isset($this->User->validationErrors['email']))), but how do I check for specific rule failure?
Looking for specific error message like if ($this->User->validationErrors['email'] == "Already exists") just doesn't seem right (l10n etc.)...