Tuesday, October 16, 2012

What to use instead of the evaluate function

I have seen on MANY occasions where it is highly advised to not use the ColdFusion evaluate function. Word on the street is, the function slows down processing of the code.

Well that's fine and dandy but if you do a search on this NO ONE gives you an alternative!!! (AUGH!!)

Well I have been using one - I can't credit it because I forgot where I found it.

Here goes:

Instead of this:    
<cfset response= evaluate("form.#VarName#")>

Use this:
<cfset response=form["#VarName#"]>


Enjoy!


More examples: 01.13.16


Instead of this: #Evaluate( "#session.languagePreference#SUBSECTION" )#

Use this: <cfset SUBSECTION = content["#session.languagePreference#SUBSECTION"]>


No comments:

Post a Comment