On Nov 25, 8:23 am, Razvan Pat <razvan....@gmail.com> wrote:
> Hello everyone,
>
> I've just started developing a website with CakePHP and already hit a
> bump. I don't understand why validation is done only when saving the
> data to the database. This is a very bad thing because:
> - you work with possible invalid data in the controller (let's say
> your making a website that calculates things and you want to put just
> the result of the operation in the database.. now you are forced to
> validate the input in the controller so that you don't get division by
> zero, that every input is a number and so on...)
> - you are going to do weird hacks for user registration. (hash the
> password field but keep the confirm password field intact for
> validation.. now validation errors would be displayed for the confirm
> password field instead of password. not something you want for a
> serious website)
>
> Now.. did I miss something and there is a way to move validation so
> that it runs before the controller? I don't even want the controller
> to run if there is a validation error...
>
> Razvan.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
Tuesday, November 25, 2008
Re: Validate before controller
http://book.cakephp.org/view/410/Validating-Data-from-the-Controller
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment