<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stillnet Studios &#187; ColdFusion</title>
	<atom:link href="http://www.stillnetstudios.com/category/coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stillnetstudios.com</link>
	<description>Web development notes and commentary from Ryan Stille</description>
	<lastBuildDate>Tue, 27 Jul 2010 14:40:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tip of the day &#8211; IsDebugMode()</title>
		<link>http://www.stillnetstudios.com/coldfusion-isdebugmode-function/</link>
		<comments>http://www.stillnetstudios.com/coldfusion-isdebugmode-function/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 14:38:25 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=902</guid>
		<description><![CDATA[Did you know there is an IsDebugMode() function in ColdFusion?  I just discovered this.  This will be great for showing additional data when you are debugging your app.  For example, you could leave this code in your order view page all the time:
&#60;cfif IsDebugMode()&#62;
    By the way here is [...]]]></description>
			<content:encoded><![CDATA[<p>Did you know there is an IsDebugMode() function in ColdFusion?  I just discovered this.  This will be great for showing additional data when you are debugging your app.  For example, you could leave this code in your order view page all the time:</p>
<pre><code>&lt;cfif IsDebugMode()&gt;
    By the way here is the complete order:
    &lt;cfdump var="#orderBean.toStruct()#"&gt;
&lt;/cfif&gt;</code></pre>
<p>IsDebugMode() will return true whenever you have debugging enabled in the Administrator and you are coming from one of the allowed debugging IP addresses.  This works in Railo and OpenBD, too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/coldfusion-isdebugmode-function/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>CFID and CFToken are now httpOnly in CF 9.0.1 updater</title>
		<link>http://www.stillnetstudios.com/coldfusion-9-0-1-httponly-cookies/</link>
		<comments>http://www.stillnetstudios.com/coldfusion-9-0-1-httponly-cookies/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 02:41:12 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=898</guid>
		<description><![CDATA[There is an interesting change in the CF9.0.1 updater that will make CF sites more secure.  The CFID and CFToken cookies will now be marked as httpOnly.  What this means is your browser will not allow JavaScript to access the CFID and CFToken cookies.  I think this will greatly help to reduce [...]]]></description>
			<content:encoded><![CDATA[<p>There is an interesting change in the CF9.0.1 updater that will make CF sites more secure.  The CFID and CFToken cookies will now be marked as httpOnly.  What this means is your browser will not allow JavaScript to access the CFID and CFToken cookies.  I think this will greatly help to reduce XSS hacks on CF sites.</p>
<p>If you are using jSessionID instead of CFID/CFToken, you need to take an additional step.  jSessionID is a session cookie, session cookies aren&#8217;t httpOnly by default.  But if you add a &#8220;-Dcoldfusion.sessioncookie.httponly=true&#8221; argument in your jvm.config file, all your session cookies will be httpOnly, including jSessionID.</p>
<p>It would be nice if there was an option to the CFCOOKIE tag to mark a cookie as httpOnly or not.  Lacking that, you could always send the cookies yourself using <a href="http://www.modernsignal.com/coldfusionhttponlycookie">cfheader</a> or <a href="http://www.12robots.com/index.cfm/2009/5/6/Making-the-JSESSIONID-Session-Token-Cookie-SECURE-and-HTTPOnly-and-settings-its-PATH">java</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/coldfusion-9-0-1-httponly-cookies/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New ColdFusion book &#8211; Adobe ColdFusion Anthology</title>
		<link>http://www.stillnetstudios.com/new-book-coldfusion-anthology/</link>
		<comments>http://www.stillnetstudios.com/new-book-coldfusion-anthology/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 03:15:44 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[Book Reviews]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=853</guid>
		<description><![CDATA[We have a new ColdFusion book!  The CF community has not been blessed with an abundency of printed materials, so I was excited when I heard this book was coming out.  Adobe ColdFusion Anthology is a compilation of Fusion Authority Quarterly Update articles.  FAQU is a great publication that has contributions from [...]]]></description>
			<content:encoded><![CDATA[<p>We have a new ColdFusion book!  The CF community has not been blessed with an abundency of printed materials, so I was excited when I heard this book was coming out.  <i>Adobe ColdFusion Anthology</i> is a compilation of Fusion Authority Quarterly Update articles.  FAQU is a great publication that has contributions from many smart ColdFusion developers.</p>
<p>This book is 476 and covers a lot of interesting things.  I&#8217;ve been using CFCs for years but I learned some new things in Michael Dinowitz&#8217;s chapters on Components.  There are articles on all the major frameworks, there is even one on the new FW/1 framework.</p>
<p>Pete Freitag has a good article on image processing that also covers creating your own captchas.  Did you know ColdFusion can read EXIF data?!</p>
<p>I also found John Mason&#8217;s article on BlazeDS interesting since I&#8217;ve never used BlazeDS before.  I&#8217;ve always been confused about the differences between BlazeDS and LiveCycle Data Services, and this article helped clear some of that up.</p>
<p>This isn&#8217;t a beginner book, I&#8217;ll bet every CF developer out there could learn a few things from this book.  Also they&#8217;ve done a nice job with the editing, everything is clearly explained. </p>
<p><a href="http://www.amazon.com/dp/1430272155/"><img src="http://www.stillnetstudios.com/wp-content/uploads/2010/06/adobe_coldfusion_anthology.gif" alt="Adobe ColdFusion Anthology" title="Adobe ColdFusion Anthology" width="125" height="165" class="size-full wp-image-856" /></a><br />
<a href="http://www.amazon.com/dp/1430272155/">http://www.amazon.com/dp/1430272155/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/new-book-coldfusion-anthology/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting a ColdFusion query to an array</title>
		<link>http://www.stillnetstudios.com/convert-query-to-array/</link>
		<comments>http://www.stillnetstudios.com/convert-query-to-array/#comments</comments>
		<pubDate>Sat, 29 May 2010 04:46:50 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=845</guid>
		<description><![CDATA[If you&#8217;ve ever had the need to convert a query column to an array, there are a couple ways to do it.  There is a queryColumnToArray function on cflib, or you could roll your own, but you can also do it with the built in ValueList and ListToArray functions.
Given the query &#8220;myQuery&#8221;, and a [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever had the need to convert a query column to an array, there are a couple ways to do it.  There is a <a href="http://cflib.org/udf/queryColumnToArray">queryColumnToArray</a> function on cflib, or you could roll your own, but you can also do it with the built in ValueList and ListToArray functions.</p>
<p>Given the query &#8220;myQuery&#8221;, and a column called &#8220;name&#8221;, you can turn that into an array with this:</p>
<p><code>&lt;cfset myArray = ListToArray(ValueList(myQuery.name)) /&gt;</code></p>
<p>The only problem with this is if the name column were to ever contain a comma, that value will get split into separate values, probably causing problems later on in your code.  I ran into this issue with some old code the other day.  The quick solution was to use a different delimiter than the default, which is a comma.  You can pick a bizarre ascii character that you are unlikely to encounter in your data.  I usually use one of the unprintable characters like 31, a &#8220;unit separator&#8221;, which sounds like a good one, doesn&#8217;t it? </p>
<p><code>&lt;cfset myArray = ListToArray(ValueList(myQuery.name, Chr(31) ), Chr(31) ) /&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/convert-query-to-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Little UDF for creating typed queries: TypedQueryNew()</title>
		<link>http://www.stillnetstudios.com/udf-creates-typed-queries/</link>
		<comments>http://www.stillnetstudios.com/udf-creates-typed-queries/#comments</comments>
		<pubDate>Mon, 03 May 2010 03:41:45 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=826</guid>
		<description><![CDATA[In our application we create some large queries using QueryNew().  Before we started specifying the datatypes we would run into strange bugs occasionally.  When you don&#8217;t specify the data type ColdFusion makes a guess.  So if we had some code like this:
&#60;cfset myQuery = queryNew('name,age,address,code') /&#62;
Then populate that query with data from [...]]]></description>
			<content:encoded><![CDATA[<p>In our application we create some large queries using QueryNew().  Before we started specifying the datatypes we would run into strange bugs occasionally.  When you don&#8217;t specify the data type ColdFusion makes a guess.  So if we had some code like this:</p>
<pre><code>&lt;cfset myQuery = queryNew('name,age,address,code') /&gt;</code></pre>
<p>Then populate that query with data from another system (in our case, its often SAP) everything usually works fine.  But ColdFusion is guessing the datatype based on the first 50 records, which can sometimes cause problems.</p>
<p>If for example, the first 50 records contain a &#8216;code&#8217; value that is all integers, ColdFusion will give that column a datatype of integer.  Then if the 51st record contains a varchar value, ColdFusion will blow up.</p>
<p>The solution is to declare the data types when creating the query, like this:</p>
<pre><code>&lt;cfset myQuery = queryNew('name,age,address,code' , 'varchar,integer,varchar,varchar') /&gt;</code></pre>
<p>This can get a little harder to manage when the query has many columns in it.  We have some with over 40 columns and it&#8217;s hard to keep track of which datatype is for which field.</p>
<p>I wrote this little helper function to make it easier:<br />
<span id="more-826"></span></p>
<pre><code>&lt;cffunction name="typedQueryNew" access="public" returntype="query"&gt;
	&lt;cfargument name="columnData" type="struct"&gt;

	&lt;cfset var columnname = "" /&gt;
	&lt;cfset var stringofColumns = "" /&gt;
	&lt;cfset var stringofTypes = "" /&gt;
	&lt;cfset var counter = 0&gt;

	&lt;cfloop collection="#arguments.columnData#" item="columnName"&gt;
		&lt;cfset counter++&gt;

		&lt;cfset stringOfColumns &amp;= columnName&gt;
		&lt;cfset stringOfTypes &amp;= arguments.columnData[columnName]&gt;
		&lt;cfif counter NEQ StructCount(arguments.columnData)&gt;
			&lt;cfset stringofColumns &amp;= ", "&gt;
			&lt;cfset stringofTypes &amp;= ", "&gt;
		&lt;/cfif&gt;
	&lt;/cfloop&gt;

	&lt;cfreturn queryNew(stringofColumns,stringofTypes)&gt;

&lt;/cffunction&gt;</code></pre>
<p>You can create a typed query much cleaner using this function:</p>
<pre><code>&lt;cfset myQuery = typedQueryNew( {
   name = 'varchar',
   age = 'integer',
   address = 'varchar',
   code = 'varchar'
   } ) /&gt;</code></pre>
<p>You can verify the data types are set using the getMetaData function:</p>
<pre><code>&lt;cfdump var="#getMetaData( myQuery )#" /&gt;</code></pre>
<p><a href="/wp-content/uploads/2010/04/typedQueryeDump.png"><img src="http://www.stillnetstudios.com/wp-content/uploads/2010/04/typedQueryeDump.png" alt="" title="typedQueryDump" width="199" height="417" class="alignnone size-full wp-image-831" /></a></p>
<p>This has helped clean up our code and makes it easier to create typed queries which cuts down on bugs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/udf-creates-typed-queries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using CFWindow within a form</title>
		<link>http://www.stillnetstudios.com/using-cfwindow-within-form/</link>
		<comments>http://www.stillnetstudios.com/using-cfwindow-within-form/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 03:13:21 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[AJAX / JavaScript]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=817</guid>
		<description><![CDATA[The CFWindow tag can be useful to prompt for information on a form.  We use this sometimes after a user has clicked the submit button.  We do some client side validation in JavaScript, and if certain conditions are met, we use CFWindow to prompt for some additional information.
Its a little tricky though.  [...]]]></description>
			<content:encoded><![CDATA[<p>The CFWindow tag can be useful to prompt for information on a form.  We use this sometimes after a user has clicked the submit button.  We do some client side validation in JavaScript, and if certain conditions are met, we use CFWindow to prompt for some additional information.</p>
<p>Its a little tricky though.  If you try to use a CFWindow tag inside a CFForm tag you will get a ColdFusion error.  If you use it inside a regular form tag you won&#8217;t get an error, but it won&#8217;t work like you expect.  Lets take this code for example:<br />
<span id="more-817"></span></p>
<pre><code>&lt;form action="somefile.cfm"&gt;
	Name: &lt;input name="name"&gt;

	&lt;cfwindow name="win"&gt;
		Age:&lt;input name="age"&gt;&lt;br /&gt;
		&lt;br /&gt;
		&lt;input type="submit"&gt;
	&lt;/cfwindow&gt;

	&lt;br /&gt;&lt;br /&gt;
	&lt;input type="button" Value="Continue" onclick="ColdFusion.Window.show('win')"&gt;
&lt;/form&gt;</code></pre>
<p>In this example we have a simple form that prompts for a name.  When the user clicks the submit button, we use cfwindow to open a popup window and prompt for age.  There is a submit button in the popup window so the user can submit the form from there.</p>
<p>But when you run this code and click on the submit button in the popup window, nothing happens.  Thats because ColdFusion places the CFWindow code near the end of the file.  It won&#8217;t be inside your FORM tags.  Changing the submit button to a button with an onclick event that submits the form won&#8217;t help either.  It will cause the form to be submitted, but only the name field will be passed in.  Age won&#8217;t be passed because that form element wasn&#8217;t inside the form tags. </p>
<p>The way around this is to use JavaScript to copy the data from the form fields to hidden fields that are inside the form.  Lets change the code to this:</p>
<pre><code>&lt;form action="somefile.cfm" id="theForm"&gt;
	Name: &lt;input name="name"&gt;
	&lt;input type="hidden" name="age" id="hidden_age"&gt;
	&lt;cfwindow name="win"&gt;
		Age:&lt;input name="age" id="age"&gt;&lt;br /&gt;
		&lt;br /&gt;
		&lt;input type="button" onclick="doSubmit()"&gt;
	&lt;/cfwindow&gt;

	&lt;br /&gt;&lt;br /&gt;
	&lt;input type="button" Value="Continue" onclick="ColdFusion.Window.show('win')"&gt;
&lt;/form&gt;</code></pre>
<p>Here I&#8217;ve added a hidden field for the age, and given IDs to both age fields and the form tag so I can reference them easily.  I&#8217;ve also changed the submit button to a regular button, and gave it an onclick handler of doSubmit.  Here is the code for doSubmit():</p>
<pre><code>&lt;script language="JavaScript"&gt;
function doSubmit() {
  var hiddenAge = document.getElementById("hidden_age");
  var age = document.getElementById("age");
  hiddenAge.value = age.value;
  document.getElementById("theForm").submit();
}
&lt;/script&gt;</code></pre>
<p>Now when the user clicks the button from the popup window, the values from that window are copied to the hidden form elements that exist in the form, and they will be passed to the server.</p>
<p>I use jQuery, which makes this even easier.  I don&#8217;t have to setup a bunch of hidden fields in the form, I just create them in the doSubmit() function.  You just need to have one element inside the form already that you can reference, so you can add an element after it.  In this example I know the name element is there so I am adding the new form elements after that.</p>
<pre><code>&lt;script language="JavaScript"&gt;
function doSubmit() {
  $('#name').append('&lt;input type="hidden" id="hidden_age" name="age"&gt;');
  $('#hidden_age').val( $('#age').val() );

  document.getElementById("theForm").submit();
}
&lt;/script&gt;</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/using-cfwindow-within-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Capitalizing the first letter of each word with ColdFusion</title>
		<link>http://www.stillnetstudios.com/capitalizing-first-letter-each-word/</link>
		<comments>http://www.stillnetstudios.com/capitalizing-first-letter-each-word/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 01:56:01 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=809</guid>
		<description><![CDATA[Capitalizing the first letter of each word &#8211; a common need for sure.  There is a function for this on cflib but it didn&#8217;t work for me.  No errors but it wasn&#8217;t returning what I expected.  I came across this function that works, and does so with much less code:
&#60;cffunction name="CapFirst" access="public" [...]]]></description>
			<content:encoded><![CDATA[<p>Capitalizing the first letter of each word &#8211; a common need for sure.  There is a function for this on cflib but it didn&#8217;t work for me.  No errors but it wasn&#8217;t returning what I expected.  I came across this function that works, and does so with much less code:</p>
<pre><code>&lt;cffunction name="CapFirst" access="public" output="false" returntype="String"&gt;
        &lt;cfargument name="inputString" required="false" type="String" default="" /&gt;
        &lt;cfreturn rereplace(lcase(arguments.inputString), "(\b\w)", "\u\1", "all") /&gt;
&lt;/cffunction&gt;</code></pre>
<p>I found this snippet on the <a href="http://www.wecodethings.com/lore/idx.php/0/032/article/ColdFusion-Initcap-Capitalize-the-first-letter-of-each-word.html">WeCodeThings blog</a>.  Good stuff.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/capitalizing-first-letter-each-word/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ColdFusion 9 disabling bold text</title>
		<link>http://www.stillnetstudios.com/cf9-disable-bold-tex/</link>
		<comments>http://www.stillnetstudios.com/cf9-disable-bold-tex/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 02:45:00 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=787</guid>
		<description><![CDATA[One of the problems I looked into this week was why some items on our site that used to be in bold were no longer displaying as such.  Viewing the source showed me that the text was indeed surrounded by &#60;strong&#62; tags. 
Using the awesome Firebug extension for Firefox, I could see that the [...]]]></description>
			<content:encoded><![CDATA[<p>One of the problems I looked into this week was why some items on our site that used to be in bold were no longer displaying as such.  Viewing the source showed me that the text was indeed surrounded by <code>&lt;strong&gt;</code> tags. </p>
<p>Using the awesome Firebug extension for Firefox, I could see that the ext-all.css file was disabling the font-weight on the strong tag.  This was quite surprising to me!</p>
<p>The ext-all.css file will automatically be included on your page whenever you use almost any of the UI features such as cfgrid, cflayout, etc.</p>
<p>You can easily reproduce the problem with this minimal code:</p>
<pre><code>&lt;cflayout type="tab"&gt;&lt;/cflayout&gt;
&lt;strong&gt;This should be bold but its not.&lt;/strong&gt;</code></pre>
<p>You can fix the problem by adding this to your site&#8217;s style sheet, if you have one:</p>
<p><code>strong { font-weight: bold; }</code></p>
<p>If you don&#8217;t use a separate style sheet you can just put it directly into your page like this:</p>
<pre><code>&lt;style type="text/css"&gt;
strong { font-weight: bold; }
&lt;/style&gt;</code></pre>
<p>Hopefully this can be fixed before 9.01 comes out.  I think its a pretty big deal, it disabled tons of bold content on our site.  A lot of our content is created using the FCK rich text editor, which uses strong tags to indicate bold.  I&#8217;ve file a bug report with Adobe, you can vote for this bug here:  <a href="http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=82156">http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#bugId=82156</a></p>
<p>After looking through the EXT documentation, I think this css originates with the EXT group.  But when Adobe repackages EXT into CF, they need to either override this style it or take it out of the css file completely.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/cf9-disable-bold-tex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Trying out the CFWheels framework</title>
		<link>http://www.stillnetstudios.com/playing-with-cfwheels/</link>
		<comments>http://www.stillnetstudios.com/playing-with-cfwheels/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 05:26:47 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=770</guid>
		<description><![CDATA[A few weeks ago, the people at CFWheels announced a contest to get people to try out CFWheels. To enter the contest all you need to do is build a version of litepost in CFWheels.  Really all you need from the litepost project is the database.  Then just build some CRUD for the users, entries, comments, etc.  I've been wanting to learn more about this framework for a while so I thought this contest would be a good excuse to check it out.  The top 3 winners get Amazon gift cards.]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago, the people at CFWheels <a href="http://cfwheels.org/blog/index.cfm/2010/1/25/Wheels-LitePost-Contest--win-Amazon-Gift-Card">announced a contest</a> to get people to try out <a href="http://www.cfwheels.org">CFWheels</a>.  To enter the contest all you need to do is build a version of litepost in CFWheels.  If you haven&#8217;t heard of litepost, its a simple blogging app thats been used to demonstrate different ColdFusion frameworks.  Really all you need from the <a href="http://code.google.com/p/litepost/">litepost</a> project is the <a href="http://code.google.com/p/litepost/source/browse/trunk/db/blogTables.sql">database</a>.  Then just build some CRUD for the users, entries, comments, etc.  I&#8217;ve been wanting to learn more about this framework for a while so I thought this contest would be a good excuse to check it out.  The top 3 winners get Amazon gift cards.</p>
<p>So far I&#8217;ve found this to be a pretty neat framework.  I see a lot of similarity to Rails.  The <a href="http://cfwheels.org/docs">documentation</a> is very good.  The plugins are pretty neat, you just drop a zip file into your plugins directory and you can start using that plugin.</p>
<p>To start I downloaded cfwheels and setup my database.  I installed the <a href="http://scaffoldwheels.riaforge.org/">scaffolding plugin</a> and used that to generate my CRUD views, models and controllers.  Already I had the basics working!  I tried creating/listing/editing users and it worked great.<br />
<span id="more-770"></span><br />
After setting up the scaffolding, I needed to define table relationships (called <em>associations</em> in CFWheels), and add some drop down menus where the scaffolding had put text fields.</p>
<p>One thing I noticed fairly quickly was that the crud pages were kind of ugly.  I started to write some CSS to clean them up, but right away ran into trouble because the form inputs were nested inside the label tags like this:</p>
<pre><code>&lt;label for="name"&gt;Name:&lt;input name="name"&gt;&lt;/label&gt;</code></pre>
<p>I haven&#8217;t seen it done that way before, I usually have the label completely separate from the input like this:</p>
<pre><code>&lt;label for="name"&gt;Name:&lt;/label&gt;&lt;input name="name"&gt;</code></pre>
<p>For me at least, that makes it a lot easier to style.  That is also how the <a href="http://www.w3schools.com/tags/tag_label.asp">W3 demonstrates the tag</a>.  At first I thought this was a problem with the scaffolding plugin, but actually its CFWheels.  The scaffolding plugin just writes code like this:</p>
<p><code>#textField(objectName='user', property='username', label='Username')#</code></p>
<p>So its the built in textField() method that generates the code this way.  I found this is easy to fix though, you can add this additional attribute:</p>
<p><code>#textField(objectName='user', property='username', label='Username', labelPlacement='before')#</code></p>
<p>That will place the <code>&lt;label&gt;</code> tag before the form input, just how I like it.  I didn&#8217;t have to go add the attribute to all by edit pages, either, you can set it in once in your settings.cfm file like this:</p>
<p><code>&lt;cfset set(functionName="textField", labelPlacement="before")&gt;</code></p>
<p>But, you&#8217;ll need to do it for all your inputs, like this:</p>
<pre><code>&lt;cfset set(functionName="textField", labelPlacement="before")&gt;
&lt;cfset set(functionName="textArea", labelPlacement="before")&gt;
&lt;cfset set(functionName="select", labelPlacement="before")&gt;
etc.</code></pre>
<p>Next I removed the created and updated timestamp fields from the create and edit pages.  The scaffolding had put them on there but I want them to be updated automatically.  CFWheels supports this, if the fields are named createdAt and updatedAt.  Unfortunately the timestamp fields in the litepost database are not named like that.</p>
<p>After digging through the documentation a little I discovered you can tell cfwheels you are using differently named timestamp columns by putting lines like these in your settings.cfm file:</p>
<pre><code>&lt;cfset set(timeStampOnCreateProperty = "dateCreated")&gt;
&lt;cfset set(timeStampOnUpdateProperty = "dateUpdated")&gt;</code></pre>
<p>I tried that but had some problems.  When trying to create a new entry (a blog article) I got this error:</p>
<p><code>Error Executing Database Query.  Field 'dateCreated' doesn't have a default value</code>.</p>
<p>It didn&#8217;t seem like my timeStampOnCreateProperty() call was working.  I finally ended up renaming the fields in my database and related code.</p>
<p>Unfortunately, I still got an error:<br />
<code>Field 'updatedAt' doesn't have a default value</code></p>
<p>I was stuck on this for a while, but one of the guys behind the contest, <a href="http://www.henke.ws">Mike Henke</a> was nice enough to help (several times in fact).  He pointed out that the error was actually about the updatedAt column now, not about the createdAt field. Hmmm.  It would make sense that updatedAt would be null when the record is first created.  But looking at the database I could see that it didn&#8217;t allow nulls for the updated timestamp.  I changed the database to allow nulls and tried creating an entry again.  This time: Success!</p>
<p>Some other things I&#8217;ve gone through:</p>
<p>By default the textField() method will use the column name for the label.  So the page ends up looking like</p>
<p>Fname:<br />
<input>
<p>I would like it to use &#8220;First Name&#8221; for the label.  I found that you can specify a label using the <em>label</em> attribute (hey that makes sense!).</p>
<p><code>#textField(objectName='user', property='fname', label='First Name')#</code></p>
<p>I ran into a similar issue with the CFWheels validation code.  Validation is done in your model file like this:</p>
<p><code>validatesPresenceOf(properties="fname,lname,email,username,password")</code></p>
<p>This makes sure those fields are not blank.  If you leave fname blank for example, you&#8217;ll get this error &#8220;Fname can&#8217;t be empty&#8221;.  I didn&#8217;t find any easy way to specify the label.  I did find there was a way to specify a custom error message, so I was able to use that and call the validation method for every field:</p>
<pre><code>&lt;cfset validatesPresenceOf(properties="fname",message="First Name can't be empty")&gt;
&lt;cfset validatesPresenceOf(properties="lname",message="Last Name can't be empty")&gt;
etc.</code></pre>
<p>I thought it would be nice if I could specify just a label to use, something like this:</p>
<p><code>validatesPresenceOf(properties="fname:First Name,lname:Last Name,email,username,password")</code></p>
<p>Even better, what if you could define a column&#8217;s label in a central place?  Maybe in the settings file, similar to how you set other column properties.  Then it could automatically use the label everywhere, including the textField() calls. So instead of having to do this:</p>
<p><code>#textField(objectName='user', property='fname', label='First Name')#</code></p>
<p>You could just do this:</p>
<p><code>#textField(objectName='user', property='fname')#</code></p>
<p>And wheels would know what label to use for fname.  This would make it really easy to change labels across the whole site!</p>
<p>To wrap it up, I think this is a promising framework that is gaining popularity.  I&#8217;ve even seen some job postings mentioning cfwheels experience desired.  I&#8217;ve done a lot of work with Model Glue, and I find it to be very heavy on configuration.  I&#8217;d like to see some changes to MG to pick up some of the great things from CFWheels.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/playing-with-cfwheels/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Wrapping tabs in ColdFusion 9</title>
		<link>http://www.stillnetstudios.com/wrapping-cflayout-tabs-cf9/</link>
		<comments>http://www.stillnetstudios.com/wrapping-cflayout-tabs-cf9/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 03:16:22 +0000</pubDate>
		<dc:creator>Ryan</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.stillnetstudios.com/?p=716</guid>
		<description><![CDATA[A while back I wrote a post explaining how to wrap the tabs generated by the new cflayout tab in ColdFusion 8.
The tabs generated by ColdFusion 9 are completely different, since they use Ext version 3.  ColdFusion 8 used Ext 1.
The tabs in ColdFusion 9 do not wrap by default, but they do automatically [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I <a href="/wrapping-cflayout-tabs/">wrote a post</a> explaining how to wrap the tabs generated by the new cflayout tab in ColdFusion 8.</p>
<p>The tabs generated by ColdFusion 9 are completely different, since they use Ext version 3.  ColdFusion 8 used Ext 1.</p>
<p>The tabs in ColdFusion 9 do not wrap by default, but they do automatically add scroll controls so you can scroll through the long horizontal line of tabs.  If you&#8217;d rather have them wrap into multiple lines, this little bit of CSS will do it:</p>
<pre><code>.x-tab-panel ul.x-tab-strip {
    width: auto !important;
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stillnetstudios.com/wrapping-cflayout-tabs-cf9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
