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.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have a cold fusion form which requires me to add a try catch around the form fields. I keep getting an error message however when I try to add it. Code below thanks for any help you provide if you see something obvious I'm missing.
 <cftry> 	
   	<cfif NOT refind("^[DdFfGgHhNnVv][A-Za-z0-9]{1,21}$", form.Contract_Number) AND NOT refind("^70[Zz]0[a-zA-Z0-9]{2}\d{2}[a-zA-Z][a-zA-Z0-9]{8}$", form.Contract_Number)>
   	<cfcatch>
	   <cfset #session.invoiceDataContr.errorString# = "The Contract Number is required and can contain no more than 22 alphanumeric characters.,">
	</cfif>
    </cfcatch>
</cftry>

Open in new window


error log message:
"Error","ajp-bio-8012-exec-3","07/25/17","11:45:07",,"Context validation error for the cfcatch tag.The tag must be nested inside a CFTRY tag. The specific sequence of files included or processed is: D:\inetpub\wwwroot\centralinv\central_inv_contr_verify.cfm, line: 121 "
0
Free Tool: Site Down Detector
LVL 9
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I need to validate 2 form fields w/ similar criteria for each field but each needs to validate w/ an older set of criteria and a new one. Code below:

  <cfset errorMsg = ""> 
   	<cfif NOT refind("^[DdFfGgHhNnVv][A-Za-z0-9]{1,21}$", form.Contract_Number) AND NOT refind("^70[Zz]0[a-zA-Z0-9]{2}\d{2}[a-zA-Z][a-zA-Z0-9]{8}$", form.Contract_Number)>
	   <cfset errorMsg = "The Contract Number is required and can contain no more than 22 alphanumeric characters.,">
	</cfif>
	<cfset session.invoiceDataContr.errorString = errorMsg>

Open in new window


     <cfset errorMsg = "">     
   	<cfif NOT refind("^[Hh][Ss][Cc][Gg][A-Za-z0-9]{1,21}$|^$", form.Task_Order) AND NOT refind("^70[Zz]0[A-Za-z0-9]$", form.Task_Order)>
	   <cfset errorMsg = "The Delivery/Task Order Number must begin with HSCG with a maximum of 25 alphanumeric characters. Do not use hyphens or special characters. The
Delivery/Task Order Number can be found in block 4 of the SF-1449 form or in block 3 of the OF-347 form.,">
	</cfif>	
	<cfset session.invoiceDataContr.errorString = errorMsg>

Open in new window


Do I need 2 different cfset params? Not sure what's up. won't catch the second validation
0
I have a very simple JSON feed and have been able to parse the feed using the below code. However, when the script gets to the "OFFERS" structure, it won't output the results cause it sees the brackets [ ] and is treating the data as a LIST of objects under OFFERS instead of objects like they would be under normal braces { }. I don't know how to get Coldfusion to properly give me the subitems of OFFERS.  You can easily see the feed using the link I provide also.

<cfoutput>
<cftry>
	<cfhttp url="https://rest.bandsintown.com/artists/spencerkane/events?app_id=day6mgmt&date=2017-08-19" result="httpResult" charset="utf-8" method="get"/>
 	<cfset BITdata = deserializeJSON(httpResult.filecontent)/>
	<cfloop array="#BITdata#" index="post">
		<cfif StructKeyExists(post, "datetime")>
			<cfset event_date = post.datetime>
		<cfelse>
			<cfset event_date = "">
		</cfif>
		<cfif StructKeyExists(post, "venue") and StructKeyExists(post.venue, "name")>
		    <cfset ev_title = post.venue.name>
		<cfelse>
            <cfset ev_title = "">
		</cfif>
		<cfif StructKeyExists(post, "venue") and StructKeyExists(post.venue, "city")>
			<cfset city = post.venue.city>
		<cfelse>
			<cfset city = "">
		</cfif>
		<cfif StructKeyExists(post, "venue") and StructKeyExists(post.venue, "region")>
			<cfset region = post.venue.region>
		<cfelse>
			<cfset region = "">
		</cfif>
		<cfif StructKeyExists(post, "offers[url]")>
		<cfset tickets = post.offers[url]>
			<cfelse>
		<cfset tickets = "">
		

Open in new window

0
Hi,

Am newbie to ColdFusion Please tell me code for login process am so confused for that can't get understand login process in my analysis.

Am tried below code,

My Form Code like,

  <!DOCTYPE html>
<html>
<head>
<title>Login</title>
Please Log In
</head>
<body>
    <cfform  name="LoginForm" action="" method="Post">
    <table>
    <tr>
    <td>Username:</td>
    <td><cfinput type="text" name="username" size="20" maxlength="30" required="yes" validate="maxlength,required" message="The Username must be between 1 and 30 characters."><br></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><cfinput type="password" name="password" required="yes" pattern="^[a-zA-Z0-9._]{8,16}$" maxlength="35" validate="required,regex" message="The Password must be between 8 and 16 characters."><br></td>
    </tr>
    </table>
    <br>
    <cfinput type="Submit" name="SubmitLoginForm" value="Submit">       
    </cfform>
      </body>
</html>

Am checking  username and password in below code,

<cfif isdefined("form.SubmitLoginForm")>
      <cfquery name="getpassword" datasource="testcf">
      select username, salt, password ,id from user where username = "#form.username#"
      </cfquery>      
      <cfif getpassword.RecordCount EQ 1>
      <cfset passwordHash = Hash(form.password & getpassword.salt, 'SHA-512') />
      <cfoutput>
      #getpassword.id#
      </cfoutput>
      <cfif getpassword.password EQ passwordHash>      
      
      <cfset session.allowin = "True">
      <cfset userid = '#getpassword.id#'/>
      <cfset…
0
Hello.

I would like to be able to browse C: \ wwwroot at http: // localhost: 8500 / test.
This is displayed as it is actually accessed.

” the page you are trying to access cannot be displayed.
please try again or notify the administrator ”

Using IIS, the physical path is set to C: \ wwwroot.
Check and set index.cfm in the default document

I'm using
windows server 2012 R2
IIS 8.5
ColdFusion 2016

I am a beginner. Please give me advice on which other setting to do.
0
<cfoutput>
<cftry>
	<cfhttp url="https://rest.bandsintown.com/artists/spencerkane/events?app_id=day6mgmt&start_date=2017-01-01" result="httpResult" charset="utf-8" method="get"/>
 	<cfset BITdata = deserializeJSON(httpResult.filecontent)/>
	<cfloop array="#BITdata#" index="post">
		<cfif StructKeyExists(post, "datetime")>
			<cfset event_date = post.datetime>
		<cfelse>
			<cfset event_date = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.name")>
		    <cfset ev_title = post.venue.name>
		<cfelse>
            <cfset ev_title = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.city")>
			<cfset city = post.venue.city>
		<cfelse>
			<cfset city = "">
		</cfif>
		<cfif StructKeyExists(post, "venue.region")>
			<cfset region = post.venue.region>
		<cfelse>
			<cfset region = "">
		</cfif>
		<cfif StructKeyExists(post, "offers.url")>
		<cfset tickets = post.offers.url>
			<cfelse>
		<cfset tickets = "">
			</cfif>

<!--- FEED OUTPUT --->        
<cfif not event_date is "">		
#event_date#<p>
#ev_title#<p>
#city#<p>
#region#<p>
#tickets#
<hr />
</cfif>		
	</cfloop>

	<cfcatch type="any">
		<p>
			<cfdump var="#cfcatch#" />
			#LSDateFormat(Now(), "dd-mm-yyyy")# #lsTimeFormat(Now(), "HH:mm")#<br />
			<a href="##">
				Oh, sorry... I can't connect to Bandsintown
			</a>
		</p>
	</cfcatch>

</cftry>
</cfoutput>

Open in new window


My output only gives me the datetime and none of the other structure data even though the raw feed in a browser window definitely shows there is more data to be displayed. I am using Adobe's output structure of data.struct1.substruct but it doesn't display anything.
0
I have a JSON feed which dumps a Facebook Page timeline feed. For some reason, Facebook allows a linked URL to be part of the actual message that is sent via JSON. So if I had a FB post that included a link to a Youtube video, it comes through the JSON feed like

'check out my cool new video http://www.youtube.com/myvideoid'

I'd prefer to strip out the url string from the JSON result and have it just give me

'check out my cool new video'

I know this has something to do with ReFindNoCase() or another similar thing, but I don't know how to write the code to strip it out and just leave me the message without the long url string.
0
Currently we are migrating from coldfusion 6 to coldfusion 2016.

<cfloop index="RSG004_i" from="1" to="#RSG004_dt.num#" step="1">

I want you to tell me how to deal with this error.
Thank you.
0
Hi,

Am using ColdFusion version 8,

Am export my Db recordset datas using,

<cfsavecontent variable="report">XXXXX</cfsavecontent>

<cffile action="write"  file = "#fullfile#" output="#report#" nameconflict="overwrite">

It's export fine,but I need to expand excel column width.Please Refer my attachment , I got my excel output like my attachment.file:///tmp/mozilla_geetha2/Employee_Report-3.xls
0
Hi, Here is the code i am trying to convert PHP code in ColdFusion code

Here is the code i have
public static function calculateSignature($consumerId, $privateKey, $requestUrl, $requestMethod, $timestamp=null)
    {
        if(is_null($timestamp) || !is_numeric($timestamp)){
            $timestamp = self::getMilliseconds();
        }
        /**
         * Append values into string for signing
         */
        $message = $consumerId."\n".$requestUrl."\n".strtoupper($requestMethod)."\n".$timestamp."\n";
        /**
         * Get RSA object for signing
         */
        $rsa = new RSA();
        $decodedPrivateKey = base64_decode($privateKey);
        $rsa->setPrivateKeyFormat(RSA::PRIVATE_FORMAT_PKCS8);
        $rsa->setPublicKeyFormat(RSA::PRIVATE_FORMAT_PKCS8);
        /**
         * Load private key
         */
        if($rsa->loadKey($decodedPrivateKey,RSA::PRIVATE_FORMAT_PKCS8)){
            /**
             * Make sure we use SHA256 for signing
             */
            $rsa->setHash('sha256');
            $rsa->setSignatureMode(RSA::SIGNATURE_PKCS1);
            $signed = $rsa->sign($message);
            /**
             * Return Base64 Encode generated signature
             */
            return base64_encode($signed);
        } else {
            throw new \Exception("Unable to load private key", 1446780146);
        }
    }

Open in new window


I have been able to get the milliseconds using the java code which is like below

<cfset jDate = createObject("java", "java.util.Date")>
<cfdump var="#jDate.getTime()#">

Open in new window



but other part of the php code i am unclear of what is happening
0
On Demand Webinar - Networking for the Cloud Era
LVL 9
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

We are looking to upgrade our coldfusion server (v 6.1) running server (2003) to a new server (server 2012) and ColdFusion 2016.

Looking for a solution/upgrade path.. If I need to upgrade first to a lower version.

If its not semi simple then possibly moving to another dev language.

Thanks in advance!
0
After upgrading to Coldfusion 16 some of the functions with my grids do not work.

I use the below code to open records on double click in the grid, and to put a total count in the grid. Neither is working and when I visit the page the debugger says carGrid is undefined. Can anyone assist?

	<script>			
		function initMyGrid(){
			carGrid = ColdFusion.Grid.getGridObject('myGrid');
			carGrid.on('dblclick', openCarRecord);	
		}
	
		function openCarRecord(){
			var recID= ColdFusion.getElementValue('frmGrid','myGrid','#varIDNumber#');
			var url = '#recordPage#?myKEY='+recID;
			location.href = url;
		}
		
	    var gridRender = function(){
		carGrid = ColdFusion.Grid.getGridObject('myGrid');
	        carGrid.store.on('load', function( ds ) {
	        carGrid.setTitle('Total records: '+ carGrid.store.getTotalCount());
	        }); 
	    };   
	</script>

Open in new window

0
hi, i have the following json Code:

{"WhoisRecord": { "createdDate": "1997-09-15T00:00:00-0700", "updatedDate": "2015-06-12T10:38:52-0700", "expiresDate": "2020-09-13T21:00:00-0700", "registrant": { "name": "Dns Admin", "organization": "Google Inc.", "street1": "Please contact contact-admin@google.com, 1600 Amphitheatre Parkway", "city": "Mountain View", "state": "CA", "postalCode": "94043", "country": "UNITED STATES", "email": "dns-admin@google.com", "telephone": "16502530000", "fax": "16506188571", "rawText": "Registrant Name: Dns Admin\u000aRegistrant Organization: Google Inc.\u000aRegistrant Street: Please contact contact-admin@google.com, 1600 Amphitheatre Parkway\u000aRegistrant City: Mountain View\u000aRegistrant State/Province: CA\u000aRegistrant Postal Code: 94043\u000aRegistrant Country: US\u000aRegistrant Phone: +1.6502530000\u000aRegistrant Fax: +1.6506188571\u000aRegistrant Email: dns-admin@google.com" }, "administrativeContact": { "name": "DNS Admin", "organization": "Google Inc.", "street1": "1600 Amphitheatre Parkway", "city": "Mountain View", "state": "CA", "postalCode": "94043", "country": "UNITED STATES", "email": "dns-admin@google.com", "telephone": "16506234000", "fax": "16506188571", "rawText": "Admin Name: DNS Admin\u000aAdmin Organization: Google Inc.\u000aAdmin Street: 1600 Amphitheatre Parkway\u000aAdmin City: Mountain View\u000aAdmin State/Province: CA\u000aAdmin Postal Code: 94043\u000aAdmin Country: US\u000aAdmin Phone: 

Open in new window

0
I've been using  sys-con.com's code in my Application.cfc file to check for malicious input through FORM and URL variables, but I'm running into issues with hyphenated variable names (specifically Google's reCAPTCHA.) This is the code I use:

<cfloop collection="#form#" item="formelement">
    <cfif isSimpleValue(evaluate(formelement)) AND refindnocase(sqlregex, "#evaluate(formelement)#")>
        <cflocation url="messages.cfm?message=invalid">
        <cfset StructClear(form)>
	<cfabort>
    </cfif>
</cfloop>

Open in new window


And this is the error I'm receiving:

Variable G is undefined.

Which makes sense, because it's looking at g-recaptcha-response. What do I need to do to my code to allow it to accept hyphenated variable names?

Thanks!
0
i have been searching on roads for best oracle fusion financials training institute. but i am not able to find the institute which opt for my requirement. where i can find best institutes details with complete details
0
We installed Coldfusion2016 on Windows Server 2012

On the server, the ColdFusion Administrator works flawlessly. The ColdFusion programs can be accessed without a problem when accessed on the server itself e.g. http://myServer:8500/CDM/customer/ /cfProgram1.cfm

However, when we access the ColdFusion programs from a PC on the network, we get error message.
HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

We read on the internet it has something to do with IIS. However, we are not that familiar with IIS.

Any help is greatly appreciated
0
I have the following sample code

<cfset testuser = {}>
<cfset testuser.data = []>
<cfset testuser.data[1] = "Test">
<cfset testuser.data[2] = "Test2">
<cfset testuser.data[3] = {}>
<cfset testuser.data[3].name = "user 1">
<cfset testuser.data[3].email = "user@email.com">
<cfset testuser.data[3].email = []>
<cfset testuser.data[3].email[1] = "Test@west.com">
<cfset testuser.data[3].email[2] = "Test2@opted.com">
<cfset testuser.data[3].email[3] = {}>
<cfset testuser.data[3].email[3].nameuser = "user 1user2">
<cfset testuser.data[3].email[3].emailuser = "user 2@email.com">

<cfdump var="#testuser#">

<cfloop from="1" to="#arrayLen(testuser.data)#" index="i">
  <cfset skdata = testuser.data[i]>
  <cfdump var= "#skData#"> //
  <cfif isArray(skdata)>
  <cfloop collection="#skdata#" item="key">
    #key#:#data[key]#
  </cfloop> 
  </cfif>
</cfloop>

Open in new window


I want to convert this code into a very simple flatten structure were i am using the following function to dobut that works only on first leveel ofstructs and does not consider arrays

<cffunction name="flattenStruct" access="public" output="false" returntype="struct">
	<cfargument name="original" type="struct" required="true"><!--- struct to flatten --->
    <cfargument name="delimiter" required="false" type="string" default="." />
	<cfargument name="flattened" type="struct" default="#StructNew()#" required="false"><!--- result struct, returned at the end --->
	<cfargument name="prefix_string" type="string" default="" required="false"><!--- used in the processing, stores the preceding struct names in the current branch, ends in a delimeter --->

	<!--- get this level's elements --->
	<cfset var names = StructKeyArray(original)>
	<cfset var name = "">
	
	<cfloop array="#names#" index="name">
		<!--- add name --->
		<cfif IsStruct(original[name])>
			<cfset flattened = flattenStruct(original[name], delimiter, flattened, prefix_string & name & delimiter)>
		<cfelse>
			<cfset flattened[prefix_string & name] = original[name]>
		</cfif>
	</cfloop>

	<cfreturn flattened>
</cffunction>

Open in new window


I am on ColdFusion version 9
0
Hi, Working on cfimage and trying to upload and resize and make image transparent from left to right like a gradient effect..

Like the Image starting from left will be good and till it reaches the right end point, it will be of gradient effect which will be white or transparent,

How can i fix it

I tried imageflip, imagetranspose but nothing seems to be working what i am trying
0
i m not able to access ColdFusion pages and admin page in our application. It is throwing 500 error with ROOT CAUSE:
coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Debugging service is not available.

I m getting below info in the logs when starting CF server. We are using CF9 on unix server. Please help.

04/26 05:02:19 Information [main] - Starting scheduler...
04/26 05:02:19 Information [main] - Starting WatchService...
04/26 05:02:19 Information [main] - Starting debugging...
coldfusion.server.ParsingConfigFileException: [/export/home/web3b2/coldfusion/coldfusion9/lib/neo-debug.xml]coldfusion.wddx.WddxDeserializationException: WDDX packet parse error at line -1, column -1. Premature end of file..
      at coldfusion.server.ServiceBase.doDeserialize(ServiceBase.java:151)
      at coldfusion.server.ServiceBase.access$000(ServiceBase.java:37)


04/26 05:02:19 Error [main] - Unable to initialize Debugging service: coldfusion.server.ServiceException: [/export/home/web3b2/coldfusion/coldfusion9/lib/neo-debug.xml]coldfusion.wddx.WddxDeserializationException: WDDX packet parse error at line -1, column -1. Premature end of file..
0
The Orion Papers
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Dear Guys,

I am having issue on protocol in Adobe ColdFusion application. I tried changing it manually on applicationlib.cfm file, but its not reflecting on the browser.

Do I need to build the application after making changes or any other method need to be followed?

Please help on this.
0
ColdFusion CFSelect will not bind and return the Selected Value in ColdFusion 11.... It works fine in ColdFusion 8 and 9, but when put on CF11 it will not work

Here is the code.

<cfselect name="Field1" id="Field1" value="" bind="cfc:cfc_Field1DrillDown.lookupField1({Field1Desc},'#vField1Category#')" bindonload="YES" />

The CFC:

<cfcomponent output="false">
      
      <!--- Lookup used for auto suggest --->
      <cffunction name="lookupField1" access="remote" returntype="array">
            <cfargument name="vField1Desc" type="string" required="true">
            <cfargument name="vField1Category" type="string" default="" required="false">
            <!--- Define variables --->
          <cfset var data="">
          <cfset var result=ArrayNew(2)>
          <cfset var i=0>
            
            <!--- Do search --->
            <cfquery datasource="#Request.FieldDSN#" name="data">
                  SELECT QueryFieldID, QueryField
                  FROM FieldNames
                  WHERE (SICDefinitionID = '#ARGUMENTS.vField1Desc#')
                  ORDER BY QueryField
            </cfquery>
            
            <cfif data.recordcount IS 1>
                    <cfset result[1][1]=data.QueryFieldID>
                      <cfset result[1][2]=data.QueryField>
                        <cfset result[1][3]=IIF(ARGUMENTS.vField1Category eq data.QueryFieldID,DE(true),DE(false))>
            <cfelse>
                  <cfset result[1][1]="N/A">
                <cfset result[1][2]="">
                  <cfloop index="i" from="1" to="#data.RecordCount#">
                    <cfset result[i+1][1]=data.QueryFieldID[i]>
                        <cfset result[i+1][2]=data.QueryField[i]>
                        <cfset …
0
- ColdFusion 11 offers the following solution for concurrent sessions but I'm running CF 10 w/ little chance of upgrading at this time. Anyone have a workaround for CF10 that would accomplish the same thing w/ as little code as possible?

https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-j-l/c
flogin.html
      <cflogin
            applicationToken = "token"
            cookieDomain = "domain"
            idletimeout = "value"
            allowconcurrent = "true|false"    <----- available in CF11
            usebasicauth = "true|false">
0
We are facing an issue with verity collection going down in two instances of a server but it works in third instance. Collection is in same shared path in the server. Each time we have to run the instance specific url to delete and recreate the collection. Can anybody suggest what can be the root cause of this. We are using CF9 and unix server.
0
Coldfusion Basic handling error Using CFTRY, CFCATCH, CFTROW, CFFINALLY
0
Can anybody help me to run mailx command through coldfusion. There is some problem with our cfmail settings and we need to send the mails using mailx command? is this possible in CF?
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.