My sign-up form can have two errors associated to the Username: leaving
it blank is an error, and choosing an existing name is a different
error. The way I discovered I could deal with this is

<?php echo $html->tagErrorMsg('User/UserName', 'Username is
required.<br>') ?>
<?php echo $html->tagErrorMsg('User/UserNameExists', 'A user with that
username exists, choose another.<br>') ?>

The hack here is that "UserNameExists" is not a field in my model, it's
a name I made up to carry that error message, and in my validation code
I have

$user = $this->findByUsername($data['User']['UserName']);
if(!empty($user)) {
   $this->invalidate('UserNameExists');
}

Does anyone know of a less hacky way to accomplish multiple errors?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to