My favorite idiom by which I live as a developer is, “It’s always the small things.” By which I mean that when there’s some catastrophic problem with my web page or software, I always scan for the little things first – missing semi-colons, syntax errors, reserved words as variables, etc. I’ve learned this from years and years of fruitlessly debugging an application for endless hours only to, in the end, find I didn’t close a tag, or left out a double quote.
Today I can add another “little thing” to the mental library.
I’m populating some Ext ComboBoxes with an array which is created by looping over a query.
Ext.mappingData.payers = [
<cfloop query="allPayersQuery"><cfoutput>['#pr_seq_no#', '#identifier#'],</cfoutput></cfloop>
];
This worked perfectly fine in Firefox, as usual. However, a user who was testing my app in IE found that the ComboBoxes weren’t working. I spent my usual hours trying to figure out why it wouldn’t work in IE. I even spent another few hours recoding one page with a band-aid workaround. I ran across the problem tonight in another page, and it just popped into my head…. the trailing comma.
I rewrote my code to build the array and trim off the last comma and it finally worked in IE.
Hopefully this post will save someone hours of work in the future.
Powered by ScribeFire.
4 Responses for "Ext Arrays, ColdFusion and IE"
For putting a single query column into a JavaScript array, there is no need to loop:
#ListQualify(ValueList(query.column),”‘”)#
To be safe, this could even be wrapped in a JSStringFormat() call.
And yet another modification to the above code
#QuotedValueList(query.column)# will put single quotes around all values in the column
Great idea guys, but I need to put two columns into the array. Looping is the only way to go in this situation. The sets also needed to be qualified with brackets. No CF tag exists to handle that.
I’m using some of the new CF8 features so I’m learning/adding more javascript to my pages and when I do a script block for SOME reason I keep losing the final closing bracket so it looks like
Leave a reply