Model: function beforeValidate() { # for add -there is no id if (!isset($this->data[$this->name]['id']) && !empty($this- >data[$this->name]['name']) &&$this->hasAny("User.name='{$this- >data['User']['name']}' ) ) { $this->invalidate('name_unique'); } # for edit - there is id if (isset($this->data[$this->name]['id']) && !empty($this- >data[$this->name]['name']) && $this->findCount("User.name = '{$this- >data[$this->name]['name']}' ) { $this->invalidate('name_unique'); }
return true; } View: <?php echo $html->tagErrorMsg('User/username', 'Please enter the Username.');?> <?php echo $html->tagErrorMsg('User/name_unique', 'Username exists...');?> On Aug 23, 10:49 pm, rtanz <[EMAIL PROTECTED]> wrote: > but what if i have more than one error? am i correct in that you can > have only one set flash message? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---