> [mailto:[EMAIL PROTECTED] On Behalf Of gwoo
> you can do most of this without any other helpers or changes to the  
> core code.
> 
> function beforeValidate() {
> 
>      $this->invalidate('username_taken');
>      return false ;
> }
> 
> the in your view
> $html->tagErrorMsg('User/username_taken', 'This username is already  
> taken. Please choose another');

I had thought about this approach, but I saw a couple problems. First, your
views need to know about your business logic so they know the types of errors
that can occur. And every time your business logic changes, you need to go
mucking about with your views to change the possible error messages. Having
this all in the model allows you to encapsulate error handling.

Also, when you localize your site, I think it will be easier to have all your
error-message logic in one place, so you can more easily retrieve and set
localized error messages from the database.

--
Regards,
Ryan Ginstrom


--~--~---------~--~----~------------~-------~--~----~
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