Don't forget you can use argumentCollection to dynamically pass
attributes to a CFC method or UDF. That would let you use cfscript if
you want to. argumentCollection for CFCs/UDFs works the same as
attributeCollection for custom tags.

On 10/3/05, wolf2k5 <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I usually prefer CFScript over CF TAGs since it's more concise.
>
> However sometimes TAGs seem better at that, e.g.:
>
> TAGs version:
>
> <cfinvoke component="#myCFC#" method="myMethod">
>         <cfinvokeargument name="myRequiredParam" 
> value="#form.myRequiredParam#">
>         <cfif structKeyExists(form,"myOptionalParam")>
>                 <cfinvokeargument name="myRequiredParam" 
> value="#form.myOptionalParam#">
>         </cfif>
> </cfinvoke>
>
> CFScript version:
>
> if (structKeyExists(form,"myOptionalParam"))
>         myCFC.myMethod(
>                 myRequiredParam = form.myRequiredParam,
>                 myOptionalParam = form.myOptionalParam,
>         );
> else
>         myCFC.myMethod(
>                 myRequiredParam = form.myRequiredParam,
>         );
>
> As you can see, I am forced to write two calls to the same method in
> the CFScript version, while I can simply use CFIF in the TAGs version
> to include the optional method in the call (only if the optional
> variable exists).
>
> As you can imagine, when there are a lot of optional arguments, I need
> to duplicate a lot of code with CFScript.
>
> Is there a better way of handling optional arguments in function
> calling with CFscript?
>
> Thanks in advance.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219880
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

Reply via email to