Coldfusion dot-notation: using multiple dots

Written on 23 February 2012, 10:25am

Tagged with: ,

A refresher about the ColdFusion structures:

ColdFusion structures consist of key-value pairs. Structures let you build a collection of related variables that are grouped under a single name.

Structure notation
ColdFusion supports three types of notation for referencing structure contents. The notation that you use depends on your requirements.

You can refer to a property, prop, of an object, obj, as obj.prop. This notation, also called dot notation, is useful for simple assignments, as in this example:
2. Associative arrays
3. Structure
Adobe Livedocs

What is interesting about the dot-notation, is that using multiple dots in referencing the object property – is allowed.
The following code executes correctly in ColdFusion 8 and outputs ‘Foo’:

<cfset myStruct = StructNew()>
<cfset myStruct.a = '1'>
<cfset myStruct.b = '2'>
<cfset myStruct.c = '3'>

<CFIF #myStruct..a# EQ 1 
	AND #myStruct.....b# EQ 2
	AND #myStruct..........c# EQ 3

CF 8 bug: ColdFusion injecting cfscript in HTML head

Written on 20 July 2011, 02:13pm

Tagged with: , ,

I recently encountered the following ColdFusion problem:
I had a HTML page where the head node contained an attribute: <head lang="fr">
The same page was also using some cfform tags.
On the CF 8 server, ColdFusion automatically injects two <script> statements immediately after <head, but ignoring any other attribute. So, in our case, the resulting HTML code was:

<head <script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>

Useless to say, this was breaking a lot of things in the design and the validation of the page.