ColdFusion Language

10K

Solutions

3K

Contributors

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'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 …
0
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
0
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
0
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:
www.mysite.com/products
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?
1
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
0
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 ?
0
Hi,

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?  

Thanks!

Ben
0
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?

Thanks!
0
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#">
                                                
                                                 #encodeForHTML(txt_email_body)#
                                                
                                            </cfmail>
</cfif>

<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>
                                    </div>
 </form>

Open in new window

0
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>
	
	<ul>
	<cfloop from="1" to="#ArrayLen(myArrayObj)#" index="i">
			<li class="all-product-content-menu">
				#i#
				<span>
					<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#" >--->
						<ul>
							<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)>
									11
								<cfelse>
								dd	
								</cfif>	
								
							</cfloop>
						</ul>
					</cfif>
				</span>
				
         		
         	</li>

	</cfloop>

Open in new window

0
Hi,

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?

Thanks.
0
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.
0
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.
0
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">
        </p>
      </form>

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.
0
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?
0
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,
CASE
WHEN h.HeadingTitle = 'Heading2' THEN 0
WHEN h.HeadingTitle = 'Heading3' THEN …
0
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">
		</cfinvoke>

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

</cfloop>

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

Open in new window

0
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.

Test.cfm

<!DOCTYPE html>
<html lang="en-US">
	<head>
		
 
		<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>
		<script 

Open in new window

0
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">
	<head>
	
	</head>
	
	<body>
	
	</body>

</html>

Open in new window


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

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

Open in new window

0
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?
0
I have a webpage with a Coldfusion / HTML form that is similar to a spreadsheet.  Users can add lines to the form via Javascript or re-sort it with the jquery sortable plugin.  Lately some users have made this form very big and then failed to hit the big save button at the bottom of the page.  They want me to make it automatically save like excel.

Is there a way to have it silently submit the form in the background occasionally?  Would it be better to try and send one field at a time to update when a field loses focus?  I have a lot of small features I have added to it over the years, so I would rather not throw out the whole thing, but maybe that's what I need to do.
0
Tried to install ColdFusion 11 on Server 2016.  The installer finished sucessfully, but when trying to open the CFadmin page, I get error 404.   Looking in IIS manager, it doesn't look like the installer created the default website like it usually does...what do I do?
0
I'm doing an ajax call to a ColdFusion function to return a query. It should return a single record with three columns for an event's title, description, and date. I want to place each of those three pieces in their corresponding divs. Everything is working fine but I can't figure out how to access the results, and the options I've Googled up have failed me. How do I get the JSON equivalent of CF's queryName.columnName? Thanks!

The jQuery I'm using is as follows:
	$('.calendar-event').click(function(){
		 var id = this.id;
		 var splitid = id.split('_');
		 var eventID = splitid[1];
				console.log(eventID);
		 // AJAX request
		 $.ajax({
			type: "POST",
			url: "/cfc/calendar.cfc?method=getEventAjax",
		  dataType: "json",
			data: {
			 returnFormat: "json",
			 eventID: eventID
		 },
			success: function(response){ 
				console.log(response);
				// Add response in Modal body
				$('#eventTitle').html(what goes here for the title?);
				$('#eventDescription').html(what goes here for the description?);
				$('#eventDate').html(what goes here for the date, and what about formatting?);
				// Display Modal
				$('#eventModal').modal('show'); 
			},
			error: function (response) {
				console.log(response);
        $("#modal-body").html("This event could not be loaded.");
				$("#eventModal").modal("show"); 
      }
		});
	 });

Open in new window


The function is simple:
<cffunction name="getEventAjax" access="remote" returntype="query" hint="returns info for single event">
		<cfargument name="eventID" type="numeric" required="yes">
		<cfquery name="qGetEvent" datasource="#APPLICATION.ds#">
			SELECT eventTitle, eventDescription, eventDate FROM calendar
			WHERE ID = <cfqueryparam value="#ARGUMENTS.eventID#" cfsqltype="CF_SQL_INTEGER">
		</cfquery>
		<cfreturn qGetEvent>
	</cffunction>

Open in new window


In the console log I'm getting
{COLUMNS(3), DATA: Array(1)},
COLUMNS: (3) ["EVENTTITLE", "EVENTDESCRIPTION", "EVENTDATE"]
DATA: Array(1)
0: Array(3)
0: "Radio Interview with Lucy Ann Lance of 1290AM"
1: "<p>Interview will take place at 8:20am EST</p>"
2: "July, 29 2019 00:00:00"
0
I have a PDF template. And I am using Coldfusion and database to get the data. Now i need to take that data and populate the PDF.  the data size is different so sometimes it is 1 page and sometimes 1+.

My template is only 1 page. How can I use the same template to say add another page
0
I'm trying to figure out how to access query data in a ColdFusion function. I have a query (qMyQuery) that's been returned from another function that will look something like this:

   | year   |  data
1  |  2014  |  1234
-------------------
2  | 2015  |  2345
-------------------
3  |  2016  |  3454

Open in new window


I'm sending it to a function that will figure out if the latest number is an increase or decrease and set the variables myQueryClass and myQueryDirectionText accordingly. This is what I'm sending:

<cfinvoke component="cfc.helpers" 
		method="setCSS" 
		returnvariable="arrayCSS" 
		forQuery="qMyQuery"
		queryData="#qMyQuery#"
		variablePrefix = "myQuery"
		>

Open in new window


And here is the function:
<cfcomponent>
	<cffunction name="setCSS" access="public" returntype="array">
		<cfargument name="forQuery" type="string" required="yes" hint="the name of the query for which to set the css">
		<cfargument name="queryData" type="query" required="yes" hint="the query content">
		<cfargument name="upIsGood" type="boolean" required="yes" default="TRUE" hint="is an increase a good thing">
		<cfargument name="variablePrefix" type="string" required="yes" hint="what to preface the class/txt variables with">
		<cfargument name="directionTextUp" type="string" required="yes" default="Increasing" hint="the text for an increase in data">
		<cfargument name="directionTextDown" type="string" required="yes" default="Decreasing" hint="the text for an decrease in data">
		

Open in new window

0

ColdFusion Language

10K

Solutions

3K

Contributors

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.