<fire addfuel="true">
<cfscript>
...
// save the form (default)
someCFC.Save();
...
// save the URL
someCFC.Save(URL);
...
someStruct = StructNew();
someStruct.someKey = "Some value";
// etc...

// save some structure
someCFC.Save(someStruct);
...

</cfscript>

CFC:
<cffunction name="Save">
   <cfargument name="someData" type="structure" default="#form#">
...
</fire>

I've been playing with CFCs for a few months now, having just converted an ASP ("OO") framework I developed (loosely based on a PHP framework I studied) into CFML. In my weaker hours I may have possibly developed constructs similar to the one above, but would not admit to it on the grounds that someone may decide it's a bad practice (TM).

You will never catch me programming or condoning the practice of passing in individual FORM elements to a function when I can pass in the entire FORM structure.

Aaron


Nando wrote:
Shrug ... you can just as easily accept a struct as an argument, calling it something like arguments.submittedValues, and pass the form scope to the function that way.

someService.processMyForm(form)

<cffunction name="processMyForm">
    <cfargument name="submittedValues">
 ...

Phillip Senn wrote:
Someone recently asked if passing the form scope was a best practice.
I found an interesting method called ArgumentCollection, but I don't
know very much about it.

Q: If you have a ton of arguments, is using ArgumentCollection the best
practice?




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