Thanks Dan. Ray sent me the answer so I will clarify here. I had made all the modifications in the entity from person.cfc to user.cfc as required to generate the proper getters/setters but I had not set the defaults in the cfproperty defs - so I got the error in cfparam because the values were null. Once I set the defaults in the entity, I didn't get the errors.
Thanks for your quick response. Susan Susan Gallegos Applications Systems Analyst, Sr. ECAT - College of Agriculture and Life Sciences Forbes 226 520-621-7181 -----Original Message----- From: Dan Vega [mailto:[email protected]] Sent: Wednesday, December 16, 2009 1:36 PM To: cf-talk Subject: Re: CF 9 - cfparam problem - ORM function The properties and their generated getters/setters are based on the Entity that was created. He most likely has a person Entity (person.cfc) that represents a person. In that file he has properties for each attribute of person. property firstname proeprty lastname property email When you change his code to person.setName() - Its looking for a property in that entity that does not exist. Make sure you go back and update the entity. Thank You Dan Vega [email protected] http://www.danvega.org/ On Wed, Dec 16, 2009 at 1:21 PM, Susan Gallegos <[email protected]>wrote: > > I am just starting with ORM so I downloaded samples from a talk by Ray > Camden - his code works but when I make small changes I get an error for > cfparam: > > Ray's code: > <h2>Edit Person</h2> > > <cfparam name="url.id" default="0"> > > <cfif url.id neq 0> > <cfset person = entityLoadByPk("person", url.id)> > <cfelse> > <cfset person = new model.person()> > </cfif> > > <cfif structKeyExists(form, "save")> > <cfset person.setFirstName(form.firstname)> > <cfset person.setLastName(form.lastname)> > <cfset person.setEmail(form.email)> > <cfset person.setHistory(form.history)> > <cfset person.setDOB(form.dob)> > <cfset entitySave(person)> > <cflocation url="index.cfm" addToken="false"> > </cfif> > > <cfparam name="form.firstname" default="#person.getFirstName()#"> > <cfparam name="form.lastname" default="#person.getLastName()#"> > <cfparam name="form.email" default="#person.getEmail()#"> > <cfparam name="form.history" default="#person.getHistory()#"> > <cfparam name="form.dob" default="#person.getDOB()#"> > > My code: > <cfparam name="url.id" default="0"> > > <cfif url.id neq 0> > <cfset user = entityLoadByPk("User", url.id)> > <cfelse> > <cfset user = new model.User()> > </cfif> > > <cfif structKeyExists(form, "save")> > <cfset user.setName(form.name)> > <cfset user.setEmail(form.email)> > <cfset user.setActive(form.active)> > <cfset entitySave(User)> > <cflocation url="index.cfm" addToken="false"> > </cfif> > > <cfparam name="form.name" default="#user.getName()#"> > <cfparam name="form.email" default="#user.getEmail()#"> > <cfparam name="form.active" default="#user.getActive()#"> > > As I said - his code runs with no problem and my code chokes at the cfparam > with default="#user.getName()#" - if I set default to "" I don't get the > error. > > Any ideas why his works and mine doesn't? > Thanks > Susan Gallegos > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329195 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

