> What if there was a case where you didn't want to save all of the
> fields again when you're updating a record?

There are a few ways to go, the easiest probably being
Model::saveField():

$this->User->id = 1
$this->User->saveField('username', 'new_username')

Or use some more complex validation to make use of the 'on' key
(http://book.cakephp.org/view/125/data-validation#on-131).

Or if you need to update a few fields, you could save some queries by
copying the data first, modifying the columns you want to change and
then saving the data.

But the current behavior is indeed correct. You simply cannot trust
that values that should be set in your form will be. If you get a
request that comes in missing a field, your validation routine needs
to pick that up. Otherwise, you'd need to do an isset() for each
required value after validation occurs.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to