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 coldfusion form that allows sending an entered text message and a pdf attachment to email addresses in a database using the cfmail tag. The database holds approx 700 addresses. I want to be able to send to no more than 100 addresses per hour once the form is submitted. The email script would insure that each address receives the message only once and if needed can add a date sent to insure that it is only sent once per month to the same address. I think I should be using cfschedule but just not sure how.
I am not that familiar with cold fusion, but I need to know something about a piece of code.

A screenshot of the relevant code is attached.

I dumped the value of the variable form.x and it is always like this:  "Added 1 codes." or "Added 2 codes." or however many codes were added.

My question is, in the code, the variable form.x seems to be used as a loop counter - how can this text value be used as a counter? Do the pound signs at either end extract the number value or something?

Thank you.
I'm trying to create a directory with the following code:

<cfdirectory action="CREATE" directory="#ExpandPath('./bloop')#" mode="644">

Open in new window

I get an error that the directory could not be created and the most likely cause of this error is that the directory already exists on my file system. (It does not; I picked a purposefully silly name that would not have been used before and DirectoryExists says it doesn't.) The StackTrace is as follows:

coldfusion.tagext.io.FileUtils$CannotCreateDirectoryException: The specified directory /var/www/vhosts/cadetesting.com/skip.cadetesting.com/bloop could not be created. at coldfusion.tagext.io.FileUtils.createDirectory(FileUtils.java:150) at coldfusion.tagext.io.DirectoryTag.doStartTag(DirectoryTag.java:330) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:2795) at cftest2dcreate2ddirectory2ecfm1395647809.runPage(/var/www/vhosts/cadetesting.com/skip.cadetesting.com/test-create-directory.cfm:1) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:446) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.IpFilter.invoke(IpFilter.java:64) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:430) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at …
I am familiar with Coldfusion and a little javascript. I am not familiar with calling APIs. I am trying to understand how I can use the OpenSRS API. Unfortunately none of their examples use Coldfusion. Can someone help me understand how I would use their API using Coldfusion

See https://domains.opensrs.guide/docs
I am using Coldfusion. I have used a tool to generate a report about cookies and with some of the cookies it had information like purpose and service. How do I add extra information to my cookies?

For example:
Name:      __tlbcpv
Purpose:      Used to record the cookie consent preferences of visitors
Provider:      .termly.io
Service:      Termly View Service Privacy Policy  

Country:      United States
Type:      http_cookie
Expires in:      20 years
Can someone please explain to me what is done to support a URL with just a pathname passed. For example, sometimes I see URLs that look something like:
and the website knows to display products.

My site is written using coldfusion.

How is this done? Is there a sub directory called products which has an index.cfm page?
Good afternoon all. I have a dilemma that I was hoping to get some help with. I thought my task was simple, but I don't understand enough about JavaScript or I'm missing something obvious. I'm basically trying to create a drop down box, and load with values from a simple Oracle database query. Easy enough. However, what I want is some additional text type form fields being filled in based on the users selection from the drop down box, also pulling that data from the database. Ive seen some examples and put something together that I thought should work, but I cant seem to get the text form fields to fill in from the selection of a drop down box. My code is below. If anyone could shed some ight on my mistakes I'd greatly appreciate it.

<cfquery datasource="PDBDEV" name="allusers">

<script type="text/javascript">
var users = [
<cfset variables.fs = "" />
<cfoutput query="allusers">
   "userID": "#jsStringFormat(ID)#",
   "userFirstName": "#jsStringFormat(fund_name_f_1)#",
   "userLastName": "#jsStringFormat(fund_name_l_1)#",
   "userPhone": "#jsStringFormat(fund_phone_1)#"
  <cfset variables.fs = "," />

<script type="text/javascript">
      function selectUser(list) {
            // assume first item is empty
            if (list.selectedIndex > 0) {
   var userID = list.options[list.selectedIndex].value;
   var userFirstName = …
Is there a way to upload multiple files (principally images) and insert them into a data table using coldfusion, similar to what appears to b capable in Wordpress
I have two .CFM, a1.cfm and a2.cfm, that cannot run at the same time. While a1.cfm is running and someone wants to start a2.cfm, a2.cfm should get the message that a1.cfm is already active and that a2.cfm cannot start.

Conversely, while a2.cfm is running, a1.cfm cannot be invoked.

Is there a ColdFusion command which can very if there is a .CFM already running ?

Am running IIS on a Windows 2016 server and ran an install of Coldfusion 2018(now on update 5).  It installed, I ran wsconfig to configure the single website on this server, but IIS doesn't appear to be handing the request off to CF.  What I'm getting instead is a question on how to handle the test.cfm file.

In the IIS UI, I have a cfmhandler mapping going to the isapimodule, and an ISAPI filter entry pointing to the correct subfolder in the CF installation (..config\wsconfig\1\isapi_redirect.dll).  

I've installed CF a number of times before including using the lockdown guide.  Haven't seen this before though.  

Any suggestions?  


Is it worth upgrading from SQL Server 2012 sp4 to a newer version of SQL Server?  I have a fairly simple application that uses SQL server and Coldfusion.  I'm in the process of setting up a new server to update the OS to Windows Server 2016.  I would like to keep using SQL Server 2012, though I know it is 8 years old.  

SQL 2012 standard does everything that I need it to do at this point, though I loathe the idea of having to upgrade it in a few years.  Also, is there any way to upgrade the license or are you starting from scratch cost wise?

Hello Experts,

I am trying to send emails through a form using basic Textarea tag and cfmail.

I am losing  user's entered new lines \n and email body ends up in a huge lengthy string of words.

cannot use high end RTF editors.
<cfif isdefined(form.fieldname)>
 <cfmail type="html"  spoolenable="false" to="#ToField#" from="blahv@tada.com" bcc="#BccField#" replyto="blahv@tada.com" subject="#form.SubjectField#">

<form action="" method="post" onsubmit="">
<div class="form-group">
                                        <label class="control-label" for="txt_email_body">email body:<span class="danger">*</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                                        <textarea richtext="true" class="multipleSelect" rows="10" id="txt_email_body" wrap="soft" name="txt_email_body" style="white-space: pre-wrap" ></textarea>

Open in new window

I am trying to create a menu from API and Coldfusion. I have DeserializeJSON result and got the nested struct of array.

The name of menu Items is called name. the parent menu may have submenu the sumbenus are in cabcategories

The sample structure is attached

The code is here:

<cfset myArrayObj = obj.categories>
	<cfloop from="1" to="#ArrayLen(myArrayObj)#" index="i">
			<li class="all-product-content-menu">
					<a id="tst_productMenu_#myArrayObj[i].id#" href="#myArrayObj[i].path#" onclick="insite.nav.hideMenu();">#myArrayObj[i].name#</a>
					<cfif ArrayLen(myArrayObj[i].subCategories)>
						<cfset objSubcategories = myArrayObj[i].subCategories>
						<!---<cfdump var="#objSubcategories#" >--->
							<cfloop from="1" to="#ArrayLen(objSubcategories)#" index="ii">
								<li><a id="tst_productMenu_#objSubcategories[ii].id#" href="#objSubcategories[ii].path#" onclick="insite.nav.hideMenu();">#objSubcategories[ii].name#</a></li>
								<cfif isStruct(objSubcategories[ii].subCategories)>


Open in new window


I have Coldfusion version 9 running on Windows Server 2008 R2.
I need to upgrade Windows Server 2008 to 2012 R2.
I know, according to the book, CF v9 is not compatible with W2012 R2.
Is there an expert out there who has or running CF v9 on W2012 OS?

How to copy large DAT files  1.36 GB from FTP to application server. Coldfusion was used earlier but it hungup at this file. we have SSIS too.

Reason they used CF earlier cause its actually parsing the copied file.
Have a main.cfm page that has an cfinclude to a JavaScript page that retrieves data from a cfc file and returns the results in a datatable and displays on my main.cfm page. The table is always less than 5 rows and can be edited. I also have a submit button that runs cfscript on another page that also retrieves other sets of data and exports to an excel workbook.
So my issue/question is how can I pass my displayed table with changes on the main page to this cfscript page and export with the rest of my data? I assume there's a way to pass the table data to another page. Been searching for a way to pass as is or in a array-structure of some sort.

Using ColdFusion, JavaScript.
Trying to pass a form value from page to page to page. On the first page have a dropdown inside a form and passes value to my next page. On that next page, I have this code:
<cfparam name="Form.SerialNumber" default="">

I have an cfinclude statement that passes that on to another page that works fine. But I also have a form on this same page that I want to pass the SerialNumber onto. So I tried this within a form:
<form name="ChartExport" id="ChartExport" action="ChartExportProcess.cfm" method="post">
        	<INPUT type="hidden" name="SerialNumber" VALUE="#Form.SerialNumber#">
        <h6>Click on "DownLoad Files" to export to excel for processing</h6>
        <p align="center">
          <input name="btnsubmit" type="submit" class="btnsubmit" value="Download Files">

Open in new window

so on the ChartExportProcess.cfm page I tried this for a test:
<cfparam name="Form.Dodic" default="">
<cfdump var="#Form.Dodic#" >

But I just get #Form.Dodic#.

What am I doing wrong? would try session but at the moment not an option.
I have working code that pulls from server into a datatable and displays correctly. What I haven't been able to figure out is how to make my data editable. Doesn't need to update the server, just be able to edit the table. I will export to excel when done with edits. Here is what I have:

Provides a dropdown to select item to search by
<!DOCTYPE html>
<html lang="en-US">
	<meta http-equiv="X-UA-Compatible" content="IE=Edge">
	<meta charset='utf-8'>


 	<cfinvoke component="Comp/Process" method="readTestTable" returnvariable="qList" />
  	<cfset lcListDropDown = '<select name="ItemA" id="ItemA"><option value="0" selected>Please Choose a ItemA</option>'>
  	<cfloop query='qList'>
  		<cfset lcListDropDown = lcListDropDown & '<option value="' & qList.ItemA & '"> ' & qList.ItemA & ' </option>' >
  	<cfset lcListDropDown = lcListDropDown &'</select>'>   

	<body onLoad="" onUnload="">
	  <div id="content_body">
	      <h1>Test Search</h1>
	        <form name="TestSearch" id="TestSearch" action="TestDataTable.cfm" method="post">
	        <table align="center" border="1" cellspacing="0" cellpadding="3" id="SearchTable">
	          	Enter search criteria, then press the <b>Start Search</b> button.
	              <td align="center" 

Open in new window

I have created a website using mostly Lucee (coldfusion) but it also has some javascript code, php and a MySQL database. I would like to use the same code for a new website and it would use its own database. What is the best way to copy over the files? One option is to use FTP to upload the files but that takes a long time since there are a lot of files. Is there a way to package the files into one file and then install it for the new website?

Also, I have noticed that a copy of my cfm and cfc files are found in a directory called cfclasses and they have been renamed. It seems that *.cfm have been renamed to *_cfm$cf.class and *.cfc have been renamed to *_cfc$cf.class. Are these precompiled files? Can I use these files instead to speed up loading of the site and so that I don't have to give away my source? If so do I have to rename all of these files back to their original names? Is there a fast way to do this?
I'm working on creating a specific table of contents structure on a web page, from data in a SQL database. The display includes indenting levels and prefixed symbols. The symbols, in order are:
Roman numerals, Upper case letters, Numbers, Lower case letters, Numbers in parenthesis, Lower case letters in parenthesis.
I. yadda
     A. yadda
     B. yadda
         1. yadda
               a. yadda
               b. yadda
         2. yadda
               a. yadda
               b. yadda
                     (1) yadda
                     (2) yadda
                              (a) yadda
                              (b) yadda

II. yadda

I'd like some help in creating this format with dynamic data. The indention and the top level Roman Numbers are working fine but it's the recursion of all the other symbols is where I could use a little help.  

Here are the sql fields I'm returning:

indentAmount, headingCount, headingName, headingText

indentAmount is the number of levels to indent. example: 0, 1, 2, 3, etc..
headingCount is the number of items for a given heading. example: 1, 2, 3. etc..
headingName is the actual name of the heading. example H2, H3, H4... etc.
headingText is the heading text itself.  In my example it's "Yadda".

Here is the query I'm running:

select h.sectionID,
WHEN h.HeadingTitle = 'Heading2' THEN 0
WHEN h.HeadingTitle = 'Heading3' THEN …
Excel's formula RATE is used to get the interest rate per period of an annuity

=RATE (nper, pmt, pv, [fv], [type], [guess])
nper - The total number of payment periods.
pmt - The payment made each period.fv - [optional] The future value, or desired cash balance after last payment. Default is 0.
type - [optional] When payments are due. 0 = end of period. 1 = beginning of period. Default is 0.
guess - [optional] Your guess on the rate. Default is 10%.
pv - The present value, or total value of all loan payments now.

I am trying to mimic the RATE formula in ColdFusion and have been successful until a certain point (see example below).

For nPER > 43 my Coldfusion function returns the wrong result.

Excel result : =RATE(44,223.51,-5000) =  0.03476
Coldfusion result : 0.0135061661

Any help is greatly appreciated

<cfloop index="nIdx" from="1" to="99">
		<cfinvoke   method="getAPR2" returnvariable="nAPR">
		    <cfinvokeargument name="parmLoan"  value="5000">
		    <cfinvokeargument name="parmDuration"  value="#nIdx#">
		    <cfinvokeargument name="parmMonthlyPayment"  value="223.51">

		<cfdump var = "#nIdx#"> .... <cfdump var = "#nApr#"><br>


    getAPR2 - 2019-09-01 using Central Bank's document
<cffunction name="getAPR2" returntype ="numeric">
    <cfargument name="parmLoan" required="true"

Open in new window

Using a ColdFusion function to return query results and was working fine.  Was required to change how I returned the data to SerializeJSON(). But when doing this, nothing returns. Not sure what the issue is unless it has to do with script sources.
I minimized the code to hopefully make it easier to follow. Test.cfm displays the results. TestJS is the JavaScript to call and return the data from Test.cfc file. The last bit of code is what I had that was working. Any ideas? CFDump will return results as well.


<!DOCTYPE html>
<html lang="en-US">
		<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
		<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css">
		<script src="https://code.jquery.com/jquery-3.3.1.js"></script>
		<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
		<script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js"></script>
		<script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
		<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>

Open in new window

Using ColdFusion 2016. I have a invoke call to run a stored procedure file. Just does some updates on the server with no return value. Not sure how to let user know complete after ran.

<cfinvoke component="model/Process" method="Drawdown" returnVariable="qRead">
<!DOCTYPE html>
<html lang="en-US">


Open in new window

function in CFC code
<cffunction name="Drawdown" 
		<!---<CFSET var qRead = "" />--->
		<cfstoredproc procedure="uspDrawdown" datasource="Inventory">

        <!---<cfprocresult name="qRead">--->
    	<!--- Return the query as a result to the caller --->
    	<!---<cfreturn qRead>--->

Open in new window

Trying to get multiple query results to display in multiple tabs on a single workbook. Using ColdFusion. New to it.
I can get the first sheet to populate and export but not sure how to add second. See code:

  	spreadSheetObj = spreadSheetNew("ActivityList"); // Create a Spread Sheet Object
  	spreadSheetObj1 = spreadSheetNew("PocList"); // Create a Spread Sheet Object
  	spreadsheetAddRow(spreadSheetObj, "Location,Region,Type,StorageType"); //Create a header
       spreadsheetAddRow(spreadSheetObj1, "Location, NAME, Phone, EmailAddress"); //Create a header
  	spreadsheetAddRows(spreadSheetObj, qActRead); //Add data to Spread Sheet Object
  	spreadsheetAddRows(spreadSheetObj1, qPocRead); //Add data to Spread Sheet Object
<cfcontent type="application/msexcel">
<cfheader name="content-disposition" value="attachment; filename=MirrLists.xls">
<cfcontent type="application/msexcel" variable="#spreadsheetReadBinary(spreadSheetObj)#"   reset="true">
<cfcontent type="application/msexcel" variable="#spreadsheetReadBinary(spreadSheetObj1)#"   reset="true">

Open in new window

Any Ideas?
I have an intranet site running on server 2016 / IIS 10, just set it up.  It uses Windows Auth so I can tell which domain user is using the site (Coldfusion reads their windows username and matches it to a staff table).

There is a page where users fill out a time sheet.  When they submit the form, the browser (Chrome) shows "bad request".  I have the site emailing me when errors occur, and when that happens, I get an error about a form field being "undefined".  The strange thing is, when I submit that same form as myself, it work perfectly, no errors.  

So, I'm thinking that it has something to do with my account, being a domain admin, and that is somehow allowing me to POST data to the server?  Does that make any sense?  All other pages work normally, it's just this one that only I can submit successfully.

I'm at a loss as to where to begin troubleshooting this...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