Programming, Technology, Web Development, Whatever
ColdFusion
CRUD problem in IE6 with cfajaxproxy
Aug 9th
When using the CFC generator in Coldfusion Builder to create a DAO for a database table, Coldfusion will create four functions
within this file, namely create, read, update, and delete. When creating a Javascript object out of the CFC using cfajaxproxy, Coldfusion will populate your document with Javascript that contains the names of these functions in the document. This will break IE6.
Typically this wouldn’t be a problem, however the trouble arises when the document is populated with the last function: delete. Whereas Coldfusion sees delete as a function within the CFC, however delete in Javascript is a reserved word to deallocate dynamically allocated memory. All other browsers (including IE7+) recognizes that delete is indeed a function of your CFC, however IE6 simply recognizes it as a reserved word, and discontinues parsing the pages Javascript, resulting in Object Expected errors when other Javascript code is executed. To get around this, you simply need to rename the delete function in the CFC to something different.
Attached Files:
Introduction to cfajaxproxy
Jul 19th
I’ve been using Coldfusion for quite some time now, but only recently have I taken advantage of what seems to be a relatively unknown or at least poorly publicized feature called cfajaxproxy, which allows you to create a Javascript object from a CFC, and dynamically interact with Coldfusion using Javascript functions. More >
Exporting to Excel using ColdFusion
Dec 19th
Sometimes you’ll have a query that you want your users to be able to export to an Excel file. If you have ColdFusion 9, you could use the cfspreadsheet tag to do this, however ColdFusion 8 users and below don’t have this luxury. Fortunately the workaround isn’t all too bad. Here’s what you do:
<cfcontent type="application/msexcel"> <cfheader name="Content-Disposition" value="filename=myFile.xls"> <table> <tr><!-- A row --> <td>A Cell</td> </tr> </table> </cfcontent>
That’s all there is to it. Basically you format the spreadsheet using HTML for a table. You can also format the cells using CSS, although results vary by which version of Excel or Open Office Spreadsheet your using. Office 2007 and 2010 allow for more customization using CSS than 2003 does, but for the most part generating simple spreadsheets using this method works pretty well. For example if I wanted to change the background color and set up a 3 column table with a header:
<cfcontent type="application/msexcel"> <cfheader name="Content-Disposition" value="filename=myFile.xls"> <table style="background-color:#366092; color:#FFFFFF;"> <tr><!-- Header Row--> <td colspan="3" style="font-size:15px;">This is a header</td> </tr> <tr> <td>A Cell</td> <td>A Cell</td> <td>A Cell</td> </tr> <tr> <td>A Cell</td> <td>A Cell</td> <td>A Cell</td> </tr> </table> </cfcontent>
Which yields:

Excel 2010
Just remember to use cfoutput when exporting ColdFusion data.
Populating a PDF From ColdFusion
Dec 10th
ColdFusion provides a lot of handy features that make it really easy to do something that seems incredibly complicated. Creating and populating a PDF dynamically is one of them.
Heres what you do:
Create a PDF with a form, that has fields that are not read only. You also need to name each field uniquely.
For this particular example I was making a PDF for a Bill of Lading.
Sample PDF Form
This PDF needs to be saved on the server in a location accessible to ColdFusion to be used as a template.
Next, populate the PDF with the following code:
<cfpdfform source="#sourcefile#" destination="#destinationfile#" action="populate" overwrite="no">
<cfpdfsubform name="form1">
<!--- Begin Field Params --->
<cfpdfformparam name="sampleFieldName" value="#someValue#" >
The cfpdfsubform is required. The default subform created by LiveCycle/Acrobat is form1, so its usually a safe bet to just go with that unless you’ve been messing around with the subforms. You can really make sure by going into the XML view of the PDF in LiveCycle.
You can read more about this tag and its uses here:
LiveDocs