Using CF Tags in CFSCRIPT

One question I see asked often is if you can use CFML tags in CFSCRIPT blocks. The technical answer is no. However, if you have CFMX, you can write wrapper UDFs for those tags and then call them from cfscript. This allows you to do stuff like:

if(foo) location(newURL);
else {

For a set of example UDFs in this area, see the CFMLLib at CFLib.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA