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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219877
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to