Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

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

Hello Experts-

I have a list of names that I am calling a db query to pull the IDs, but am having trouble getting the IDs into an actual list.  It is returning 16 487 488 rather than 16,487,488

<cfset affiliateList = #form.id#><!--- Looks like.... C - DME Media,KC - Floor Coverings International - Google HL,KC - Floor Coverings International - Yahoo --->
    
     <cfloop list="#affiliateList#" index="i" delimiters=",">
        <cfquery name="getAffiliateID" dbtype="query">
            select affiliateID
            from getCampaigns
            where name IN ('#i#')
         </cfquery>
         
     	<cfoutput query="getAffiliateID">
        	<cfset finalList = valuelist(getAffiliateID.affiliateID,",")>
           <cfdump var="#finalList#"> 
         </cfoutput>
     </cfloop> 

Open in new window

0
Enroll in September's Course of the Month
LVL 10
Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Trying to show member attendance at meetings. The concept here is that we would enter a meeting date, select the various members who attended, then be able to show a listing of which meetings a particular person attended, with the names in the first table column and meeting dates in successive columns. This is the code I am currently using but it gives a lot of false showings for each person

 <cfquery name="getDates" datasource="#conn#">
   select * from meeting_attendance
</cfquery>
<cfquery name="getMembers" datasource="#conn#">
   select * from members where member_userid <> 1
   and member_userid IN
         (select member_userid from meeting_attendance where attended = 1)
   order by lastname, firstname
</cfquery>
<cfoutput>
<table>
  <tr>
    <td>&nbsp;</td>
      <cfloop query="getDates" group='meeting_date'>
      <td>#dateformat(getDates.meeting_date, 'mm/dd/yyyy')#</td>
      </cfloop>
  </tr>
  <cfloop query="getMembers">
  <tr>
    <td>#getMembers.firstname# #getMembers.lastname#</td>
      <cfloop query="getDates">
      <td align='center'><cfif attended eq 1>Yes</cfif></td>
      </cfloop>
  </tr>
  </cfloop>
</table>
</cfoutput>

Example of current output

                            09/05/2017
member name      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Yes      Y
0
I'm looking for help with an excel file export from a Cold Fusion form...The html version is working fine but the excel is blank. Has anyone had any issues w/ this. The form is working for the html and pulling from the db. The excel version is just blank with the same parameters.

The only modification was to increase the max size of a field to 17 from 16 in the index.htm file to account for an increased reference number. Simple change but and the test db has been updated w/ the criteria to pull from but for some reason the excel file isn't populating. I know this is vague but I'm hoping someone can shed some light or at least point me somewhere I can find some assistance. Thanks.
0
MySql 5.7 / Coldfusion 11

I have a real estate property search form with multiple fields for instance  City, Price, Acres, etc... and a Keyword input that needs to be able to further filter these results.   Example: I need to be able to find only properties listed in a certain city by a certain agent the agents name goes in the "keyword" input.

I have 3 tables in my database that I need to query and do a fulltext search on; "listings",  "fagents", "fcoagents"  
so I added fulltext index for each.

ALTER TABLE listings ADD FULLTEXT(Class,Type,SubType,City,PropertyName,Highlights,Remarks,Agent,CoAgent,AddressNumber,AddressStreet,Zipcode);

ALTER TABLE fagents ADD FULLTEXT(AgentFName,AgentLName,AgentEmail);

ALTER TABLE fcoagents ADD FULLTEXT(AgentFName,AgentLName,AgentEmail);


SELECT * FROM listings
LEFT JOIN fagents ON listings.Agent = fagents.Agent
LEFT JOIN fcoagents ON listings.CoAgent = fcoagents.CoAgent

WHERE (Status = "Active" OR Status = "Pending")

AND

<!---Search by City--->
<cfif StructKeyExists(form,"City") and listLen(trim(form.City), ",")>
 AND City IN
        (
             <cfqueryparam value="#form.City#"
                   cfsqltype="cf_sql_varchar"
                   list="true"
                   separator=",">
     )
</cfif>

<!---Search by keywords--->
<cfif StructKeyExists(form,"Keyword") and len(trim(form.Keyword))>
AND
0
I have been uploading pdf and jpg file from our local server to a hosted server using FTP. However, for security reasons the hosted server stopped the FTP service two weeks ago. The hosted server told us to start using CFHTTP to replace FTP.

We were using CFFTP for:
<cfftp action = "open"
<cfftp action = "remove"
<cfftp action = "close"
<cfftp action = "LISTDIR"
      Etc…

Does anyone have a Coldfusion example on how to transfer file from a local server to hosted server ? I have never used CFHTTP before
0
I need a form field mask for a date field to read: MM/DD/YY in a cold fusion form.

I have other fields working but the date field won't take. Would the letters vs. numbers be issue. My current code is setup for the mask:

<cfset session.invoiceDataContr.Invoice_Date = "MM/DD/YY" >

Open in new window

 <font face="Arial" size="2" color="#990000"><label for="Invoice_Date">Invoice Date:&nbsp;</label>
                        <input  id="Invoice_Date"  name="Invoice_Date" size="15" maxlength="8" type="date"  tabindex="8"  value="<cfif structkeyexists(session.invoiceDataContr, "PASS")><cfoutput>#session.invoiceDataContr.Invoice_Date#</cfoutput><cfelse><cfoutput>#form.Contract_Number#</cfoutput></cfif>" required/>

Open in new window

0
I need to validate a date field with MM/DD/YY requirements using a regex within a cold fusion form.
0
Current code that's breaking is:

1:^(([\w\!#$%&'*+-/=?^_`{|}~;]+(?:\.[\w\-_]+)*@(?:[\w\-_]+\.)+[a-zA-Z]{2,7})[;]?)+$

Open in new window


error message:

"Error","ajp-bio-8012-exec-5","07/31/17","10:55:57",,"Invalid CFML construct found on line 214 at column 73.ColdFusion was looking at the following text:<p>\'</p><p>The CFML compiler was processing:<ul><li>An expression that began on line 214, column 69.<br>The expression might be missing an ending #, for example, #expr instead of #expr#.<li>The tag attribute pattern, on line 214, column 53.<li>A cfparam tag beginning on line 214, column 6.<li>A cfparam tag beginning on line 214, column 6.<li>A cfparam tag beginning on line 214, column 6.</ul> The specific sequence of files included or processed is: D:\inetpub\wwwroot\centralinv\central_inv_contr_verify.cfm, line: 214"

I'm guessing the # is throwing an issue and maybe the $ and ^ ... anyone have any ideas to get around the coding errors for those characters:
0
Hello Experts,

I have trouble getting a Connection Failure. Status code unavailable. response  after waiting for longtime.

Response when using coldfusion to submit
response
Response when copy pasting the URL in the borwser

 
{
  "success": true,
  "challenge_ts": "2017-07-28T17:28:02Z",
  "hostname": "wsq02230"
}

Open in new window


<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<cfsetting requestTimeOut = "9000" />
<cfparam name="FORM.username" default="" type="string" >
<cfparam name="FORM.password" default="" type="string" >

<cfif structKeyExists(FORM,"submit")>
	
	<cfset recaptcha = FORM["g-recaptcha-response"] >
	<cfif len(recaptcha)>
		
		<cfset googleUrl = "https://www.google.com/recaptcha/api/siteverify">
		<cfset secret = "XXXXXXX">
		<cfset ipaddr = CGI.REMOTE_ADDR>
		<cfset request_url = googleUrl & "?secret=" & secret & "&response=" & recaptcha & "&remoteip=" & ipaddr >
		
		<cfoutput>
		#request_url# 
				<cfoutput>
				<!--- <cfhttp url="#request_url#" method="post" timeout="10" result="captcharesult">
					<cfhttpparam name=remoteip value="#ipaddr#" type="url">
				</cfhttp> --->
				<cfhttp url="https://www.google.com/recaptcha/api/siteverify" method="post" result="captchaResult">
				  <cfhttpparam type="formfield" name="secret" value="#secret#"> 
				  <cfhttpparam type="formfield" name="response" value="#recaptcha#"> 
				  <cfhttpparam type="formfield" name="remoteip" value="#CGI.REMOTE_ADDR#"> 
				</cfhttp>
				
		

Open in new window

0
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
Not sure which OpenStack Certification to get?
Not sure which OpenStack Certification to get?

So you’ve realized you might want to get certified in OpenStack, but you’re not sure what the benefits might be or even which one you should take. You know there are several certification courses you can choose from, but how do you know which one is right for you?

Form field validation for a date requirement to be: Current date on or after 10/01/2017 - cold fusion form

A new requirement for a form. I need to detect the date a form is being submitted to be the current date on or after 10/01/2017 in a cold fusion form.

The date won't be placed into the form field/s but I need to detect the date. This will be implemented on 10/01/2017 fyi. I'll need to set the code up to test say for today's date then once working set it up to detect 10/01/2017 for when it goes live.

Thanks for any help. I'll start researching the topic as I've never tried to work this type of code before. Current code for one of the fields is:

  <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

0
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
Hi, I have a dynamic CF page with  printout tables. Problem is with printing. Table printout can be split depending on the dynamic content. I need to force a new page for each table output. Is there a CF or html string I can use to force this break

many thanks
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
Hello Experts,

I am working on a CF application and need a CF function equivalent to exit(); (PHP).

I am trying to addess this particular fix
Acunetix reference

This is what I am doing, but not sure if t works.  

<cfset GetPageContext().getCFOutput().clear()>
   <CFLOCATION URL="Login.cfm?Message=Logon ID must be 5 digits." ADDTOKEN="no">
	<CFABORT>

Open in new window


- Dan
0
I have courses for agents to study online.  I have a save and exit button when clicked will save their place and close the window.  However, if the student just clicks on the X on their browser and closes the window my system does not currently recognize that they are no longer active in the course.  We tried "onbeforeunload" but that gets triggered if the student is just going to the next page.  I only want to trigger it if they click to close the browser using the X.
0
I have a form that is completed online that now needs to be generated as a saved pdf file in a folder on the server. The name and location for the pdf would then be emailed to someone for them to retrieve for viewing. As an aside, would also need to know best way to have a signature placed into the pdf when created (I realize this is 2 questions in 1. 1st one more important for now)
0
PowerShell Core for Advanced Linux Administrators
PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

I have the code below trying to use cfif and cfelseif to validate on form field, which is for a contract number. I need to use one form field but validate w/ 3 different sets of criteria using 3 different sets of regex validations. Its currently not working and I'm sure the syntax I'm using is off. I'm new to CF much less using cfelseif but I believe I'm on the right track...can anyone provide some suggestions on how to rework this please?

thanks in advance...see code below:
<cftry>
  
   <cfif>
    <cfparam name="form.Contract_Number" pattern="^[DdFfGgHhNnVv][A-Za-z0-9]{1,21}$" type="regex" default="#form.Contract_Number#">
    <cfcatch>
		<cfset #session.invoiceDataContr.errorString# = #session.invoiceDataContr.errorString#&"The USCG Contract Number is required and can contain no more than 22 alphanumeric characters,">
    </cfcatch>
      
       <cfelseif>
       
       <cfparam name="form.Contract_Number_Z" pattern="^70Z0\d{4}[CDF]\d{8}$" type="regex" default="#form.Contract_Number_Z#">
       <cfcatch>
		<cfset #session.invoiceDataContr.errorString# = #session.invoiceDataContr.errorString#&"The TSA Contract Number is required and can contain no more than 22 alphanumeric characters,">
       </cfcatch>
        
         <cfelseif> 
                     
        <cfparam name="form.Contract_Number_T" pattern="^70T0\d{4}[CDF]\d{8}$" type="regex" default="#form.Contract_Number_T#">
        <cfcatch>
		<cfset #session.invoiceDataContr.errorString# = 

Open in new window

0
Good Afternoon, I would like to get some assistance with something I'm trying to do. I have a query that queries a table and gets various project information from that table, and it works fine. I have another table that has many comments about each project, so I have a one to many situation. My problem is that all UI want to retrieve from that second table is the last comment entered. I store the date of the last comment so I thought I would be able to do some sort of retrieval with a max date but not sure how to go about it. Ultimately I'm building a spreadsheet so the query is being built to populate the spreadsheet. Everything works fine till I had the 'proj_reason_closed' field. That the field that has many entries for each project.

SELECT DISTINCT proj_no,
spl,
capces_location,
capces_state,
capces_description,
maxdate,
proj_closed_reason,
ob_date_sort

FROM  (SELECT DISTINCT

       current_bulk_filter.proj_no,
       current_bulk_filter.capces_location,
       current_bulk_filter.capces_description,
       current_bulk_filter.capces_state,
       current_bulk_filter.spl,
       capces_support_data.ob_date_sort,
       spend_plan_history.proj_closed_reason,
       x2.maxdate

      FROM   mca.current_bulk_filter

left join mca.spend_plan_history
        ON ( current_bulk_filter.proj_no = spend_plan_history.proj_no and
             )

WHERE ......
0
is it possible to set up a regex to validate each position in a string of characters in a form field?

I have a requirement for a contract number field in a Cold Fusion form. Requirements are:

•      Positions 1-6 will be the  70Z0XX where XX is the contracting office code IE: 23.
•      Positions 7-8 will be the two digit Fiscal Year IE: 17.
•      Position 9 will be the one character instrument code IE: C, D, F.
•      Positions 10-17 will be agency assigned number.
•      New Example: 70Z02317D00000001

Is it possible to set up an expression at different points w/in the string of characters? I've never done that...only length requirements and forcing it to start w/ either a number or a letter. thanks for any help.
0
I want to keep cookies alive even after restarting Coldfusion on the server each morning.  Screen-Shot-2017-06-21-at-8.51.25-AM.pngI am attaching the settings from Coldfusion.

Thanks for your help
0
I have one form field with a Cold Fusion form that is requiring 2 different sets of criteria for validation....can this be done?

I have 2 sets of criteria for a contract number field w/in a CF form field. One is requiring the contract number to begin with a numeric character the other alphanumeric. I currently have the one set that needs to start w/ a letter but need to add the validation using a regex to the same form field to trigger the field to validate for the additional set of criteria that requires the new contract number configuration to begin with a number.

Current setup for the validation is:

			, Contract_Number: {
				required: true
			   ,pattern: /^[DdFfGgHhNnVv][A-Za-z0-9]{1,21}$/

Open in new window


Form field setup:

                        	<font face="Arial" size="2" color="#990000">
                            <label for="Contract_Number">Contract Number:&nbsp;</label>
							 <input type="text" name="Contract_Number" id="Contract_Number" minlength="8"  maxlength="22" tabindex="7" value="<cfif structkeyexists(session.invoiceDataContr, "PASS")><cfoutput>#session.invoiceDataContr.Contract_Number#</cfoutput><cfelse><cfoutput>#form.Contract_Number#</cfoutput></cfif>" required/>
                        	<font size="1" color="navy" title="No hyphens or special characters, OF-347 block 2, SF-26 block 2, SF-1442 block 4, SF-1449 block 2, SF-33 block 2">(help)</font></font>

Open in new window


Is there a way to use a hidden field maybe? I'm not sure its even possible to do. This will need to use jquery for client but also needs server side validation as well.

I'm thinking I can use as try catch and w/in that use a cfif/cfelse setup:


Open in new window

0
Bootstrap validator trying to validate the form and submit to the database. The validation part works but it does not submit

the link is here https://jsfiddle.net/tsomik1/5cu96c6y/10/
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.

Top Experts In
ColdFusion Language
<
Monthly
>