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 i
The flow is beforeValidate -> validate -> beforeSave -> save
First beforeValidate() callback is to check data and make global
decision go further / this data cannot be validated/saved. If answer
is no save() immediately returns false.
If beforeValidate() was successful actual validation occurs. If
Most tutorials or tips online refer to before Save () as a good before
saving to clean data and what not but never have i seen anything on
beforeValidate as beforeValidate seems to be better to use i would think.
No?
For example city has validation rules say min 5 characters if someone enters
"b"
It appears that's it. Thank you.
"beforeSave: Called before each save operation, after validation.
Return a non-true result to halt the save."
On Dec 2, 9:38 am, "j0n4s.h4rtm...@googlemail.com"
wrote:
> Check what those methods have to return, at least(maybe both) one of
> them (I "think" it was
Check what those methods have to return, at least(maybe both) one of
them (I "think" it was beforeSave) has to return true;
On Dec 1, 10:46 pm, naidim wrote:
> Sorry, I meant to say the code is in the user MODEL not controller.
Check out the new CakePHP Questions site http://cakeqs.org and help
Sorry, I meant to say the code is in the user MODEL not controller.
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,
When I use this function as beforeValidate in users_controller it
works. When I change it to beforeSave (and remove the
parent::beforeValidate(); call) it returns to /users/edit (built via
scaffolding) with a flash "Please correct errors below." with no
errors identified in the form. Slug has no va