syntax error in expressions structure

Posted on 2014-08-10
Last Modified: 2014-08-11
ColdFusion 9

Hi. I am working with some ColdFusion sample code supplied by, and I am getting what looks like a syntax error. Here is the error:

Invalid CFML construct found on line 55 at column 41.
ColdFusion was looking at the following text:
The CFML compiler was processing:
    An expression beginning with (, on line 55, column 22.This message is usually caused by a problem in the expressions structure.
    A cfset tag beginning on line 55, column 2.
The error occurred in C:/websites/ line 55
53 : <!--- Because coldfusion's ListToArray object ignores empty fields, we must
54 : put a null in all empty fields to make sure that they are not skipped --->
55 : <cfset post_response=(cfhttp.filecontent, "||", "|null|", "all")>
56 : <!--- the same command is run twice, because the first time it only adjusts
57 : every other empty field --->

Open in new window

Here is the code ... I will include what seems relevant to the error, but please let me know if you need the entire form:

Name:        RegisterConference.cfm
Author:      EB
Description: 1) process information for conference registrants; 2) populate payment page with data entered in the registration form
Created:     July 2014
Revised: August 2014
ColdFusion Version 9
MS SQL Server 2012

<!--- stuff--->

<cfset paymentConfirmed="">

<cfhttp method="Post" url="">

	<!--- the API Login ID and Transaction Key must be done with valid values --->
	<cfhttpparam type="Formfield" name="x_login" value="xxxxxxxx">
	<cfhttpparam type="Formfield" name="x_tran_key" value="yyyyyyyValue">
	<cfhttpparam type="Formfield" name="x_delim_data" value="TRUE">
	<cfhttpparam type="Formfield" name="x_delim_char" value="|">
	<cfhttpparam type="Formfield" name="x_relay_response" value="FALSE">
	<cfhttpparam type="Formfield" name="x_duplicate_window" value="30">
	<cfhttpparam type="Formfield" name="x_type" value="AUTH_CAPTURE">
	<cfhttpparam type="Formfield" name="x_method" value="CC">
	<cfhttpparam type="Formfield" name="x_card_num" value=#cardNumber#>
	<cfhttpparam type="Formfield" name="x_exp_date" value=#cardDate#>
	<cfhttpparam type="Formfield" name="x_card_code" value=#cardCCV#>

	<cfhttpparam type="Formfield" name="x_amount" value=#totalBilled#>
	<cfhttpparam type="Formfield" name="x_description" value=#salesDescription#>
	<cfhttpparam type="Formfield" name="x_cust_id" value=#x_cust_id#>
	<cfhttpparam type="Formfield" name="x_invoice_num" value=#invoiceNumber#>
	<cfhttpparam type="Formfield" name="x_company" value=#x_company#>
	<cfhttpparam type="Formfield" name="x_first_name" value=#x_first_name#>
	<cfhttpparam type="Formfield" name="x_last_name" value=#x_last_name#>
	<cfhttpparam type="Formfield" name="x_address" value=#cardAddress#>
	<cfhttpparam type="Formfield" name="x_city" value=#cardCity#>
	<cfhttpparam type="Formfield" name="x_state" value=#cardState#>
	<cfhttpparam type="Formfield" name="x_zip" value=#cardZip#>
	<cfhttpparam type="Formfield" name="x_country" value=#cardCountry#>
	<cfhttpparam type="Formfield" name="x_email" value=#emailAddress#>
	<cfhttpparam type="Formfield" name="x_phone" value=#phone#>
	<cfhttpparam type="Formfield" name="x_line_item" value=#qbLineItem#>

<!--- Because coldfusion's ListToArray object ignores empty fields, we must
put a null in all empty fields to make sure that they are not skipped --->
<cfset post_response=(cfhttp.filecontent, "||", "|null|", "all")>
<!--- the same command is run twice, because the first time it only adjusts
every other empty field --->
<cfset post_response=(post_response, "||", "|null|", "all")>

<!--- now the ListToArray method can be used without skipping fields --->
<cfset response_array=ListToArray(post_response, "|")>

<cfparam name=response_array[1] default="">
<cfparam name=response_array[3] default="">

<cfset errorNetCardNumber="">
<cfset errorNetCardCCV="">
<cfset errorNetExpiration="">
<cfset errorNetCardAddress="">

<cfif response_array[1] is "1">
	<cfset errorpayment="0">
	<cfset paymentConfirmed="paymentConfirmed">
	<cfset errorPaymentMessage="">
	<cfset errorpayment="1">
	<cfset paymentConfirmed="declined">
	<cfset errorPaymentMessage="<h3><b>Your Credit Card has been 
declined. Please check your information and correct any 
	<!--create card error messages-->
	<cfif response_array[3] is "6" or response_array[3] is "37">
		<cfset errorNetCardNumber="<h3>Your credit card number is 
	<cfif response_array[3] is "7" or response_array[3] is "8">
		<cfset errorNetCardNumber="<h3>Please check your card number, 
expiration, CCV, and address.</h3>">
	<cfif response_array[3] is "11" >
		<cfset errorPaymentMessage="<h3>This submission of your Credit 
Card has been declined because it is a duplicate entry.<br>Please wait a few 
moments before resubmitting it.</h3>">
	<cfif  response_array[3] is "45" or response_array[3] is "65" >
		<cfset errorNetCardNumber="<h3>Please check your card number, 
expiration, CCV, and address, one at least does not match.</h3>">
		<cfset errorNetCardNumber="<h3>Please check your card number, 
expiration, CCV, and address, they don't match what is on file.</h3>">
	<cfif response_array[3] is "27">
		<cfset errorNetCardNumber="<h3>There is an error in your card 
		<br>Please check your card number, expiration, CCV, or 

<!--- / stuff --->

Open in new window

I am not sure what I am doing to cause a problem in the expressions structure. What am I missing?

Thanks as always. =)

Question by:Eric Bourland
    LVL 51

    Expert Comment

    From the comments, it looks like they meant to do some sort of replace but forgot to include the function name before the "(" in these two lines:

         <cfset post_response=(cfhttp.filecontent, "||", "|null|", "all")>
         <cfset post_response=(post_response, "||", "|null|", "all")>

    Try adding the "replace" function:

         <cfset post_response= replace(cfhttp.filecontent, "||", "|null|", "all")>
         <cfset post_response= replace(post_response, "||", "|null|", "all")>

    That said... the example seems like it was written for an old version of CF.  The comment about list functions and empty elements is no longer true.  Might want to rewrite some of it to take advantage of newer functionality.
    LVL 51

    Accepted Solution

    I think you can just replace those three lines with:

         <cfset response_array=ListToArray(cfhttp.filecontent, "|", true)>

    Open in new window

    LVL 3

    Author Comment

    by:Eric Bourland

    Good morning. It's working; your solution makes sense. I am working with sample code from the web site; this deprecated code was written years ago.

    My current task is to have people fill out a simple conference registration form, selecting an attendance option and an appropriate fee -- submit the form -- and then display the filled-out payment form, where the user can then fill in credit card info. (I do not want to deal with credit cards and PCI compliance; I will let handle this.) This has been an ongoing challenge -- but I am learning a lot.

    This solution works great. =)

    LVL 3

    Author Closing Comment

    by:Eric Bourland
    Thanks as always. _agx_. Hope you're great.


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    If found in a list 6 25
    Changes in SQL Server with ColdFusion 19 53
    Coldfusion to PHP conversion utility 4 129
    Database structure 4 106
    This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
    This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now