Ok, but why to create a new User if you want to update and existing one ? Maybe I do not catch really what you want to do, but if you edit only some fields of data and submit form for update, why the overhead of create new user etc .... Do not get me wrong, surely you have a good reason that I do not catch yet. Anyway, if cake is doing the job you want, everything is fine.
Franck On Jul 7, 3:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Yeah yeah sure, to clarify what I'm doing is displaying only a summary > of the users > data to them for editing. > > I guess the flow of things is: > > Take the edited data out of this->data > Stuff the data into a new User object (making sure I include the ID to > perform an update rather than a insert > Call save > > And only the updated fields will be updated in the database. > > Does that sound about right. > > On Jul 7, 1:42 pm, francky06l <[EMAIL PROTECTED]> wrote: > > > Yes a 3rd method that I forgot. By the way, I do not understand the > > purpose of editing a field and not saving it. The form can "display" > > only certain fields, as long as they are not "editable" they will not > > be posted. > > > On Jul 7, 2:36 pm, "Gonzalo Servat" <[EMAIL PROTECTED]> wrote: > > > > On 7/7/07, francky06l <[EMAIL PROTECTED]> wrote: > > > > > Actually only the fields that are in this->data will be saved. To > > > > limit the update you have 2 ways : > > > > > 1) if you do not need to show/edit certains fields in the form, just > > > > read what you need for the form using an array of field names. > > > > 2) before saving the data, use unset($this->data['Model']['field']) to > > > > avoid saving a field > > > > There is a 3rd way: > > > > $this->save( $this->data, true, $arrayWithFieldList ); > > > > By passing the $arrayWithFieldList, it tells the save function to only > > > save > > > values for those fields (this helps avoid situations where a user might > > > insert hidden fields into the HTML before submitting and causing issues > > > (like, perhaps, inserting the id field as a hidden field causing it to > > > update somebody else's record)) > > > > Hope this helps. > > > > - Gonzalo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---