Tanguy, I think I knew what you meant. Thanks for clarifying though. I'll give this a shot. I'll have to work on it a bit as I am working within the confines of Mach-II. When either form is submitted, it currently calls the updatePerson function in PersonService.cfc. This creates the Bean and runs its init. Instead of doing this, I'll run the DAO's Read function based on the Primary Key ID.
Then I'll have to somehow determine what fields were on the form (possibly using the formfield list) so that I can run the appropriate setters. I would rather do this dynamically somehow (and this is why I was entertaining Mike's ideas) so I don't have to do "If the form came from here, run these setters, Else if the form came from here, run these". Both you and Mike were helpful, I think I can get it to work with these ideas. Matt On 3/30/06, Tanguy Rademakers <[EMAIL PROTECTED]> wrote: > > This is driving me nuts because i can tell i'm not explaining what i mean > well - mea culpa. > > Let's use an example: > > I have a person bean, with fields id, name, and email. > > I have an instance of this bean: > id 1 > name Matt > email [EMAIL PROTECTED] > > I have a person DAO, with methods > load(id) -> returns person bean > save(person bean) -> returns boolean. > > I have two forms: one used to edit both the name and email of a person, > one used to edit only the email. Both embed the id in a hidden field so i > know which user to update. > > My problem: how to avoid "blanking out" the name field of a person when > processing the second form. > > Solution: for both forms, follow this method: > - user submits form > - use id field to load the person bean > - call the appropriate setters, depending on which form you used: > form one: call setName and setEmail > form two: call setEmail ONLY > - call personDAO.save() and pass it your bean. > > Now, in the case of form two, you will NOT overwrite the name (Matt) > because the value of getName() *IS* "Matt". You will not need to use a bunch > of ugly IF statements in your SQL, you will update every database field each > time - but in this case, the before and after values are *both* "Matt" > > Does that make more sense? > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236617 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

