We help IT Professionals succeed at work.

ColdFusion Language





ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.

I have a site that conducts encryption/decryption of data, with the process being guided by a specified encryption key that is included in the application.cfm file. However, since they updated the server to CF 11, I have started consistently getting the following error

An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same..
The error occurred in D:/home/rilsintake.org/wwwroot/left_side_nav.cfm: line 35
33 : <cfoutput>
34 : <cfloop query="all_calls_in_unit" startrow="#url.startrow#" endrow="#endrow#">
35 :       <li><a href="callback.cfm?intakeid=#intakeid#"> #Decrypt(URLDecode(all_calls_in_unit.CLIENT_LASTNAME), "#enc_key#")#, #client_firstname#</a> -<cfif all_calls_in_unit.court_date is not "">
36 :         <font color="##FF0000">#DateFormat(call_intakedate, 'mm/dd/yy')#</font>
37 :             <cfif all_calls_in_unit.interpreter is 'Y'><br><font color='0000ff'><strong>Interpreter Needed</strong></font></cfif>

Any suggestions will be helpful.
Dear experts,

i have an input text form on my page with a value defined
i would like to put a condition with a cfif element to show something, depend on this value defined
but when i try a <cfif form.test eq "x"> it tell me an undefined form element.. Is there a way to show something depending on the value input form with a cfif form on the same loaded page ?
To be clear upfront, I'm not a professional - just trying to get a task done and I have minimal expertise. What I thought would be easy is apparently not so. I've dealt with APIs and XML but it's always been me initiating. This is apparently different.


Receive HTTP POST Webhook data from my Wordpress/Woocommerce website.


If you're receiving an http post and it contains the variable/value status:completed


Loop through line_items in this transaction


Do this if the item is a download


Do some database inserts. I've got all this code written and ready to go.


1.  The webhook is working and being received perfectly by RequestBin.
2.  HTTP in JSon is being sent.
3.  I'm not even sure the request is being heard by my CF Template.
4.  When I try to write the received data into a session variable so I can at least see it, nothing is there?!?!
Need to know... Is my code being triggered? If not, how can I make it be so. AND Once I'm able to assess that I'm receiving data, how can I curse down into it and grab the bits of info (is the result an array or structure and what's the syntax to drill down)?? Specifically, I only need...





First line of code in my CF template to receive HTTP POST from Webhook

Open in new window

Coldfusion / Mysql

I have a database field "photos" that holds a comma delimited string of photo URL's and feeds a slideshow.   the code below works,  but I also now have a field "thumbs" that contains another comma delimited string of photo URL's. I want to populate these as my thumbnail images instead of just using the large image as I have in the below code snip.  How would I accomplish this? Any help appreciated.

<!---this code works but doesnt uses the main photo as a thumbnail--->

<cfloop list="#photos#" index="ListItem" delimiters=",">
	 <a class="rsImg" data-rsh="500" data-rsBigImg="#trim(ListFirst(ListItem))#" href="#trim(ListFirst(ListItem))#" alt="#details.AddressNumber# #details.AddressStreet#, #details.City#, #details.State# #details.zipcode#">
		<img width="96" height="72" class="rsTmb" src="#ListItem#" /></a> 


<!---this code doesnt work--->

<cfloop list="#photos#" index="ListItem" delimiters=",">
<cfloop list="#thumbs#" index="ListItem2" delimiters=",">

	 <a class="rsImg" data-rsh="500" data-rsBigImg="#trim(ListFirst(ListItem))#" href="#trim(ListFirst(ListItem))#" alt="#details.AddressNumber# #details.AddressStreet#, #details.City#, #details.State# #details.zipcode#">
		<img width="96" height="72" class="rsTmb" src="#ListItem2#" /></a> 


Open in new window

I need to run some programs sequentially from one CFM.

DailyTask.CFM must call pgmA.cfm which does some database updating.

As soon as pgmA.cfm is done, pgmB.cfm must be called. PgmB.cfm inserts records into a table.

Once PgmB.cfm is finished, pgmC.cfm must be called. PgmC.cfm also updates a table.

pgmA.cfm should not have <cflocation url="pgmB.cfm" > and pgmB.cfm should not have <cflocation url="pgmC.cfm" >

So from with dailytaks.cfm, pgmA.cfm, pgmB.cfm, and pgmc.cfm must be called sequentially.

Is this possible ?
Dear Experts,

I work with Coldfusion and from an input type file, i uploaded an image show in the current page. i would like that a resizable rectangle appear when this image upload and be able to crop the image by clicking on a button attached to it when the resizable rectangle appears but still in the current page, without load it by a submit form.
does anyone have some suggestions to do it with Coldfusion and may be Javascript ?

ExpertsExchangePowershellSanitized.txtHow to do a recursive file lookup in powershell? I have a list of files in Folder A and need to look in Folder B and Folder C to see if that file exists in either B or C. If there is already a file with the same name as the file in A then I need to rename the file from Folder A until there is no file by that name in Folders B or C.  The file signature is this:  SomeCode_Year_Month_Day_Hour_Minutes_Seconds.pdf. When I look in Folder B and C and the file is found I change the name to increment by one second in the "Seconds" part then I copy it to Folder B and Folder C and delete it from Folder A. I had been using the file hash to find the duplicates but that seems like overkill. I just really need to check the file names. Folders A, B, and C are guaranteed to exist. I will need to keep checking the file name and incrementing by one second until there are no duplicate file names.
Hello experts,

My client is struggling to put in the CF 2016 Update 8 security patch.

installation begins and then an error appears saying insufficient permissions. same login was used to roll back to update 7.

here is the posting on adobe forums
How to access a global variable within a javascript .each() function? Yes, I know this is bad practice but I still need to do it. I'm creating a form with dynamic form input fields. I'm iterating through those fields and if the value is zero or an empty space I want to form validation to let the user know they need to enter a number.  But when I try to edit the global variable or modify a form field value I'm not able to do that. I'm using jquery to do this. Can anybody offer a way validate this form without a plugin? Attached is my code. I'm using cold fusion and jquery as the base language.
Good morning all!! I have a question related to ColdFusion, JavaScript and IE11. I have some code, that works fine in compatibility view in IE11, that basically is three drop downs, all containing results of a database query. Only the first dropdown is visible at the beginning. If the user selects "More" from the first drop down box, the second box becomes visible. Then if in that second box, a users selects a certain item, the third box will appear. I need to make this work without the dependency of adding the domain to the compatibility view. I thought it would work with no issues, but I was very wrong. Could someone guide me on what I need to change/do to make this work??

<SCRIPT LANGUAGE="JavaScript">	  
function objectShowForm(thisObject, thatObject) {

     // Check for invalid object references
     if (!thisObject || !thatObject) {return false;}
     // Get the selected value 
     // (currently only works with single selection lists and text fields)
     if (thisObject.type == "select-one") {
          listIndex = thisObject.selectedIndex;
          var value = thisObject.options[listIndex].value; // you can also use .text
     } else if (thisObject.type == "text") {
          var value = thisObject.value;

     // Show or hide the hidden field
     if (value == "99"){
     } else {
     return true;
function showElement(elem) {
     if (!elem) {return 

Open in new window

I am trying dynamically to insert a structure into MS SQL using the below code.

When I run the code I get the  message.
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '<'.

However, when running the resolved SQL no error is shown.

Any help is greatly appreciated

To create table
USE [tfdata]



CREATE TABLE [dbo].[mortgEdit1](
	[meId] [int] IDENTITY(1,1) NOT NULL,
	[meBatchNo] [int] NULL,
	[meModule] [nvarchar](64) NULL,
	[meActive] [nvarchar](16) NULL,
	[meAction] [int] NULL,
	[meComments] [nvarchar](256) NULL,
	[meDateCreated] [datetime] NULL,
	[meDateUpdated] [datetime] NULL,
	[meCreatedBy] [nvarchar](64) NULL,
	[meUpdatedBy] [nvarchar](64) NULL,
	[meId] ASC

Open in new window

CF Code

<cfset strucmortgEdit1 = structnew()>
<cfset strucmortgEdit1.meComments = "This is a test">
<cfset strucmortgEdit1.meActive = "Activie">
<cfset strucmortgEdit1.meBatchNo = 250>

<cfset keyList = structKeyList(strucmortgEdit1)>	
<cfset keyValueList = "">
<cfset counter = 1>	

<cfloop List="#keyList#" index="listItem">
    <cfset keyValueList = keyValueList & '<cfqueryparam 

Open in new window

Having problems with output from table join. Have 2 tables with a shared field (typeid) but when outputing only shows 1 record from the primary table. Code being used is as follows

<cfquery name="get_problems" datasource='#conn#'>
SELECT w.typeid, w.problem_type, c.typeid, c.problem_area
FROM problem_types w
  INNER JOIN problem_areas c
    ON w.typeid=c.typeid
ORDER BY w.problem_type ASC
<cfoutput query='get_problems'>
I moved the source database of ColdFusion (CF) from SQL 2005 to SQl2008/2012  and the CF  page errors out  when I try to insert
Any inputs

Also I want to know what is causing the insert to fail--what do I have to add to my  cfcatch block below?
I am only seeing this on the page   ---Error occurred while adding to the  database.  Please try again
<cfcatch type="any">
                <cfdump var="#cfcatch#" />
      <cfset insertstatus = false>  
 <cfif insertstatus EQ false>
  <div align="center" class="errorBig">
         Error occurred while adding to the  database.  Please try again
Good morning, I have a question related to using an multi select HTML box, and passing the selections to a SQL query. I'm using ColdFusion and I have no problems with the creation of the multi text box. I query my database to fill the multi select box:

<SELECT Name="SelectPrograms" MULTIPLE size="12">
      <cfoutput query="ProgramList">
      <option value="#PROGRAM#">#PROGRAM#</option>

On the action page, I did a simple output to make sure I was getting the result from what I had selected:

<cfloop list="#form.SelectPrograms#" index="SelectPrograms">

I selected two items from the box, and the cfoutput returns correctly. But what I need to do now is to pass those selections to a CFQUERY result WHERE statement, so I want to select various fields from my database where the "Programs" equal the two Programs I selected from the multi select box. This is my problem. My query s only picking up the first one, and not the second so I have my quer where statement incorrect but I'm not sure what it's looking for.

<cfquery name="ProgramList" datasource="MCA_Oracle">
      BUDGET_MIPRS_SENT.PROGRAM = '#SelectPrograms#'            

<cfloop query="ProgramList">
<cfoutput>#ProgramList.MIPR_NUMBER#; #ProgramList.PROGRAM#</cfoutput><BR>
I am sending a text message to client phone numbers using coldfusion cfmail tag. The problem is as a from I am suing support@testSite.com. The problem is on my email server I do not get a record that the message was sent. What I'm trying to do is to marry questions sent with the response. Now I am getting the responses but I do not see the original message. My email server is Zmail (Zimbra)
I have he following code where from the query i am trying to get the first 500 records and then next 500 and so on

Here is my code, i am stuck as to what and where i should make the change to make it work

<cffunction name="queryConvertForJQGRID" access="package" returntype="struct" output="no"> 
    <cfargument name="q" type="query" required="yes"> 
    <cfargument name="page" type="numeric" required="no" default="1"> 
    <cfargument name="rows" type="numeric" required="no" default="10"> 
    <cfset var result = structnew()> 
    <cfset var rowStruct = structnew()> 
    <cfset var col = ""> 
    <cfset result["page"] = arguments.page> 
    <cfset result["total"] = ceiling(arguments.q.recordcount/arguments.rows)> 
    <cfset result["records"] = arguments.q.recordcount> 
    <cfset result["rows"] = arraynew(1)> 
    <cfoutput query="arguments.q" startrow="#(arguments.page-1)*arguments.rows+1#" maxrows="#arguments.rows#"> 
      <cfset rowStruct = structnew()> 
      <cfset rowStruct['viewed'] = viewed>
      <cfset rowStruct['id'] = q['id'][currentrow]> 
      <cfset rowStruct['status'] = q['status'][currentrow]> 
      <cfset rowStruct['template'] = q['template'][currentrow]> 
      <cfset rowStruct['line'] = q['line'][currentrow]>
      <cfset rowStruct['error_message'] = q['error_message'][currentrow]>
      <cfset rowStruct['error_type'] = q['error_type'][currentrow]>
      <cfset rowStruct['datein'] = q['datein'][currentrow]> 

Open in new window

I am trying to generate an HTML from an AJAX call, Below please find my code.

The content should display HELLO WORLD in bold. However, I am getting <strong>hello world</strong>

Any assistance is highly appreciated

<html xmlns="http://www.w3.org/1999/xhtml">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>

    <script type="text/javascript">

        $(document).ready(function() {
            $("#loadLink").click(function(e) {
                    type: "GET",
                    url: "ajaxHTML.cfc?method=createHTML",
                    contentType: "application/json; charset=utf-8",
                    dataType: "html",
                    success: function(message) {

    <a href="" id="loadLink">Load Query</a>
    <!-- empty div to load dynamcically generated table into -->
    <div id="mydiv"></div>

Open in new window

<cfcomponent displayname="Generate HTML" output="false">

<cffunction name="createHTML" displayname="Create HTML" description="Creates HTML to output with jQuery." access="remote" output="false" returntype="string">

    <cfset VARIABLES.html = "">

    <!--- SAVE CONTENT --->

    <cfsavecontent variable="VARIABLES.html">
    	<strong>hello world</strong>
    <cfreturn VARIABLES.html>



Open in new window

ColdFusion 9

I am trying to embed a signature image into an email.  The image is created:

<cfoutput><cfsavecontent variable="content">#TicketSignature#</cfsavecontent></cfoutput>
<cfset Signature = ImageReadBase64(content) />
<cfimage name="thisSignature" source="#Signature#" action="read" >

When I "WritetoBrowser" the image appears fine.  All good so far.

In my Cfmail tag I use:

<cfmailparam file="signature.png" contentid="signature" content="#thisSignature#" disposition="inline" type="image/png" />
<img src="cid:signature"> to show the image.

My problem:  For some reason the image in the email is viewed as a negative image ... black background and light blue signature.  Somehow, the cfmailparam tag is converting the image.  Why???  I have tried everything I can think of, but nothing will change it back to white background and black signature.

Any thoughts would be very helpful.

I have a form that allows the user to create 5 different sets of results on the same form. I do this by using CFLoop. For example:
<cfloop from=”1” to=“5” Index=“i”>
Form FieldName#i#

So I end up with:

That part works great and keeps the form code short and clean considering there are 16 form fields.

Is there a way to loop over that data to insert it into a table. Each Index needs to be its own row in the table. For example…

<cfloop from=”1” to=“5” Index=“z”>
<cfquery datasource = “abc”>
Insert into XYZ (Name)
Values (#form.FieldName[z]#)

What I don’t know how to do is use a variable (the index) within a variable (Form.Result).  Parts of the form need to go into 6 different tables times 5 sections of the form would be 30 SQL statements vs. 6 if I can loop.
I'm trying to duplicate a row in a MySQL table and give it a new ID (which is the primary key column.) If I run the query directly through phpMyAdmin, it works. If I run it on my CF page, it gives me the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE tempEvent SET ID = NULL; INSERT INTO calendar SELECT * FROM tempEvent' at line 4

Do you know why this would be? (As a side note, I get the same error if I use the cfqueryparam tag or hardcode a value, and with/without semicolons.) Thanks!

<cfquery datasource="#APPLICATION.ds#" result="copiedEvent">
		SELECT * FROM calendar 
		WHERE ID = <cfqueryparam value="#FORM.eventID#" cfsqltype="CF_SQL_INTEGER">;
	UPDATE tempEvent 
	INSERT INTO calendar SELECT * FROM tempEvent;

Open in new window

I need to create a set of dropdowns that are related to each other in coldfusion. The second dropdown should update itself based on what is selected in the first. Both will draw data from queries but from 2 separate data tables (cities and states). When the form finally submits, want to be able to retrieve id numbers from each dropdown

Have tried a number of coding variations with no luck
I need to rewrite a slq query within a cold fusion file to get rid of INDENTITY_ON and IDENTITY_OFF due to security issues. I've started recoding using IDENTIYCOL but I'm stuck. Below is the current code that will need to be rewritten w/ result_name.IDENTITYCOL vs. INSERT_IDENTITY ON/OFF. I opened a previous question about this but that was to work using IDENTIY_INSERT ON/OFF. I'll close that question but really need help on this asap.

1:<cfif ((#duplClaim# NEQ "Y") and (#requestId# EQ 0))>
2:<cfquery name="getNextID" datasource="#dsn#">
3:select (max(id) + 1) as nextID from TLAClaims
5:<cfset requestId = "#getNextID.nextID#">
7:<cfquery name="InsertClaim" datasource="#dsn#">
9:insert into TLAClaims (ID, lastName, firstName, eeEmail, travelbegindate, travelenddate, numberofdays,  unit, approver, submitdate, tono, claimAmount, customerNotes,  employeeId, documentation, status, deoEmail, claimType)
10:values ('#requestId#', upper('#lastName#'), upper('#firstName#'), '#eeEmail#', '#travelbegindate#', '#travelenddate#', '#numberofdays#', '#unit#', '#approver#', '#todaysDate#', '#tono#', '#claimAmount#', '#customerNotes#', '#employeeId#', '#documentation#', 'Inactive', '#deoEmail#', '#claimType#')

 I've started writing this code w/o the INSERT_IDENTIY ON/OFF but I'm stuck now:
1:<cfif ((#duplClaim# NEQ "Y") and (#requestId# EQ 0))>
2:<cfquery name="getNextID"…
After upgrade from CF2016 to CF2018 getting "connection refused" error on open CSV file. SQL Server 2012. Windows Server 2012
It is working with CF2016 but not CF2018

     HTML Code Format  <PRE>Error Executing Database Query. [Macromedia][SequeLink JDBC Driver]TCP/IP error, connection refused. &lt;br&gt;The error occurred on line 40.</PRE> 

Open in new window

<cfset FilePath = "C:\home\mywebsite\wwwroot\test\countrycodeToDialcode.csv">
             <cfquery name="GetInternationalDialcode" datasource="dialCodes"
             cachedWithin = "#CreateTimeSpan(1, 0, 0, 0)#">
                           SELECT *
                           FROM #filePath#

Open in new window

I have ColdFusion 10 installed. I am using <cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 5, 0 ) /> and <cfset THIS.SessionTimeout = CreateTimeSpan( 0, 0, 0, 5 ) /> to inactivate a session when there has been more than 5 unit of inactivity. I would like the user to re-login. The problem is that the login.cfm and index.cfm are in the root directory together with application.cfc. If a time out occurs at http://mycom.com/customer/receivables/showPayment.cfm and user clicks on reload button of browser, user is not redirected to login screen. Is there a trigger in CreateTimeSpan to redirect the user to http://mycom.com/index.cfm upon inactivity?
I'm getting a couple of error message when running a sql query from a cold fusion file. I believe if I solve one I can solve the other but I'm not exactly sure how to best solve it.


Error Executing Database Query.[Macromedia][SQLServer JDBC Driver][SQLServer]IDENTITY_INSERT is already ON for table 'tlaSQL.dbo.TLAApprovers'. Cannot perform SET operation for table 'TLACLAIMS'. The specific sequence of files included or processed is: D:\inetpub\wwwroot\TLA\Admin\TLAattachments.cfm, line: 148 

Open in new window

Error Executing Database Query.  
[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot find the object "TLACLAIMS" because it does not exist or you do not have permissions.  
The error occurred in D:/inetpub/wwwroot/TLA/Admin/TLAattachments.cfm: line 146
144 : <cfset requestId = "#getNextID.nextID#"> 
145 : 	
146 : 	<cfquery name="qTurnOnInsert" datasource="#dsn#">
148 : </cfquery>

DATASOURCE   tlasqlpp 

Open in new window

Sample code w/in cfm file:

<cfquery name="qTurnOnInsert" datasource="#dsn#">

<cfquery name="qTurnOnInsert" datasource="#dsn#">

<cfquery name="InsertClaim" datasource="#dsn#">
insert into TLAClaims (ID, lastName, firstName, eeEmail, travelbegindate, travelenddate, numberofdays,  unit, approver, submitdate, tono, claimAmount, customerNotes,  employeeId, documentation, status, deoEmail, claimType) 
values ('#requestId#', upper('#lastName#'), upper('#firstName#'), '#eeEmail#', '#travelbegindate#', '#travelenddate#', '#numberofdays#', '#unit#', '#approver#', '#todaysDate#', '#tono#', '#claimAmount#', '#customerNotes#', '#employeeId#', '#documentation#', 'Inactive', '#deoEmail#', '#claimType#')

Open in new window

I've researched and come up w/ turning the insert off then back on after the query. I've also landed on possibly using result_name.IDENTITYCOL but that looks like its only useful for a cf dump from what I've found. Can anyone help w/ this?

Thanks much for any help.

ColdFusion Language





ColdFusion is a server-side rapid application development platform originally created by Allaire and now sold by Adobe, implementing the dynamic general purpose CFML programming language. The term ColdFusion is sometimes colloquially used to refer to the CFML language (Cold Fusion Markup Language), but can also include discussions of the server software implementation. ColdFusion runs using a customised version of Apache Tomcat. Earlier versions are bundled with JRun.

Top Experts In
ColdFusion Language