Re: cfscript: optional arguments in function calling
I would rather have the method(s) hanlde the logic than the excution code pass optional arguments. myCFC.myMethod(form); Let the method handle all the checking and call other methods if needed. Joe On 10/3/05, wolf2k5 <[EMAIL PROTECTED]> wrote: > On 10/3/05, Raymond Camden <[EMAIL PROTECTED]> wrote: > > 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. > > Thanks, I forgot I could use argumentCollection! > > ~| 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:219937 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
Re: cfscript: optional arguments in function calling
On 10/3/05, Raymond Camden <[EMAIL PROTECTED]> wrote: > 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. Thanks, I forgot I could use argumentCollection! ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219890 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
Re: cfscript: optional arguments in function calling
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: > > > value="#form.myRequiredParam#"> > > value="#form.myOptionalParam#"> > > > > 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
Re: cfscript: optional arguments in function calling
if you are the one writing the code in the methods, saying what is optional, just make a cfparam of the optionals with the default set in the method. Then pass all arguments in. 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: > > > value="#form.myRequiredParam#"> > > value="#form.myOptionalParam#"> > > > > 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:219879 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
cfscript: optional arguments in function calling
Hi, I usually prefer CFScript over CF TAGs since it's more concise. However sometimes TAGs seem better at that, e.g.: TAGs version: 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