It depends,

it depends on your use case. For instance if one may enter text into a
huge textfield, maybe richtext for instance, its better to sanitize
after READING it from the database, not upon writing (beforesave).

If you want to change things on the fly before validation its no
problem. For instance if you require first and last name, and both do
neither start nor end with whitespace, tab, linebreak but with some
other character and are at least 3 letters long, you can strip those
whitespaces (lets say with trim()) in beforeValidate. The result will
also be that on validation issues the result in the form will be
modified (while beforesave the modification is not visible to the user
at any chance).

There is no general rule where it is best to do do, beforeValidate,
beforeSave, afterRead

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to