At 09:47 AM 3/8/2007, Sammy Larbi wrote:
On Tue, 2007-03-06 at 17:37 -0800, Jim Cassata wrote:
> I have a question. is it ok to pass the #form# structure to the CFC as a single variable? Or is it better to pass the individual form arguments? I know both work in CF, just wondering if one way is better for making the CFC more universal (have plans for some Flex down the road)
>


I guess it would depend on how you are using it.  If you pass it as a
struct and really need everything, then I don't see a problem (as in,
you are updating a user, and the form contains all that information you
need).  But in cases where it would be lying to say "I need a struct,"
which would hide the real value you want, then I think that would be
bad.  An example of this would be something like calculateTax(form).
Well, you don't want form, you want only the price stored in the form.

I think this actually ties into the discussion on argumentCollection.

You don't want your CFC to know about your form structure. But, if you know that your form structure has the arguments that the method needs, you can use argumentCollection to pass in the whole form structure - with each field being used as a separate argument.

Steve


You are subscribed to cfcdev. To unsubscribe, please follow the instructions at 
http://www.cfczone.org/listserv.cfm

CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]

Reply via email to