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 validation and state only
requires 2 case insensitive letters.
function beforeValidate() {
parent::beforeValidate(); // Just sanitizes input
// Automatically uppercase state string
if (!empty($this->data)) {
$this->data['User']['state'] = strtoupper($this->data
['User']['state']));
$this->data['User']['slug'] = Inflector::slug(strtolower
($this->data['User']['username']));
}
}
Since it works as beforeValidate I guess I have no need to modify it,
just curious why it doesn't work as beforeSave.
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment