----- Original Message -----
Sent: Tuesday, October 07, 2003 4:05
PM
Subject: Re: [CFCDev] Code Reuse
Hi Paul,
It is possible and recommended.
In fact, you shoudn�t have FORM or any other
scope favriables inside your cfc, only arguments, thats the best
practice.
Althou you may want to pass and get every
argument independenttly, which seems more flexible and more OO.
As you mnay know, form, as all other scopes, is a
struct.
All you would have to do is duplicate your form
struct and then pass it to the cfc call, something like:
<cfset customer = Duplicate(FORM) >
(you may use StructCopy, but this only duplicates
the first struct 'level' and creates pointers to nested structures,
don�t use customer = form, because this will only reference the form structure
and any change made to the customer struct will change the value of the
form).
Regards,
----- Original Message -----
Sent: Tuesday, October 07, 2003 5:43
PM
Subject: [CFCDev] Code Reuse
Ok, I am really trying to utilize CFC's and
utilize their pronounced ability to handle alot of good code
reuse.
I have a CFC that handles customer
information. And I have two ways that customer information can be
populated and manipulated:
1) Through a form (form.firstName,
form.lastName)
OR
2) Though a struct being passed to the CFC
customer.firstName, customer.lastName
It is possible (and good practice) to create 1
simple function that can handle both inputs? How do you decern between
the two scopes?
Any suggestions and help would be
appreciated.
Also, are their any good resources out their
for code reuse as it pertains to CFC's or even CFMX in general.
Paul Giesenhagen
QuillDesign