<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.cfwheels.org/~d/styles/itemcontent.css"?><rss xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
   <channel>
      <title>ColdFusion on Wheels Bloggers</title>
      <description>A stream of blog posts from CFML developers who use ColdFusion on Wheels.</description>
      <link>http://pipes.yahoo.com/pipes/pipe.info?_id=4258363960ec2fbd438d68d764c7faa6</link>
      <pubDate>Thu, 02 Sep 2010 14:59:19 -0700</pubDate>
      <generator>http://pipes.yahoo.com/pipes/</generator>
      <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.cfwheels.org/cfwheels/bloggers" /><feedburner:info uri="cfwheels/bloggers" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
         <title>Very good progress with my form application in CF on Wheels. Saving data to multiple database tables was never easier!</title>
         <link>http://combofusion.posterous.com/very-good-progress-with-my-form-application-i</link>
         <description>&lt;p&gt;&lt;div&gt;Recently I started to focus on ColdFusion on Wheels Framework and to be honest I am really starting to enjoy it so much that I just can't get off my computer even when soccer is on TV! For the last 5 days I've been glued to the chair, reading blogs, documentation, watching screen-casts and coding simple examples (inspired by &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/screencasts"&gt;Chris Peters' screencasts&lt;/a&gt;) that are really helping me learning to work with Wheels. &lt;strong&gt;The reason is the simplicity of everything in Wheels!&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;My idea is to&amp;nbsp;show you an example of what can a newbie in Wheels (such as myself) accomplish with this amazing MVC based framework.&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;As I promised on the &lt;a rel="nofollow" target="_blank" href="http://groups.google.com/group/cfwheels/browse_thread/thread/7ae1d71787c6de6d"&gt;CF on Wheels Google Group&lt;/a&gt;, here's an update on my work regarding those multiple database tables in ColdFusion on Wheels Framework, that were bugging me in the &lt;a rel="nofollow" target="_blank" href="http://combofusion.posterous.com/ideas-about-saving-form-data-into-multiple-ta"&gt;previous post&lt;/a&gt;. I hope this one comes in handy to someone. I am sure that when it'll be finished and when I'll show you how I did it, you will definitely see the real value of Wheels and of course Coldfusion itself.&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;Please be patient, since the application is not finished yet - it is work in progress.&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;Right now I am just giving you a screen-cast with no comments. I know, I could wait until it is done, but maybe it is better to watch the evolution of this app in segments as it evolves into something more complicated, but in a way that also a Wheels newbie, such as myself, can understand how everything is done and hopefully get some new knowledge from it.&amp;nbsp;&lt;/div&gt;
&lt;p /&gt;
&lt;p&gt;
 
 
 
&lt;iframe class="embeddedvideo" src="http://screenr.com/Content/assets/screenr_1116090935.swf" height="308" width="500"&gt;&lt;/iframe&gt;
 
&lt;/p&gt;
&lt;div&gt;
&lt;p /&gt;
&lt;div&gt;In case you want to see a bigger screen, click here:&amp;nbsp;&lt;a rel="nofollow" target="_blank" href="http://screenr.com/WNr"&gt;http://screenr.com/WNr&lt;/a&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;What I used while playing with the form&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;My screencast shows how I was able to use the Scaffold plugin and turn it into a nice, very usable web form with some CSS applied to it. It also shows some error reportings (the 1st step) and how I made it possible to the user to go back and forth from one form to another. At the end you will also see the preview of the data and the possibility to edit the end result before submitting it.&lt;/div&gt;
&lt;p /&gt;
&lt;/div&gt;
&lt;div&gt;In the app (in the screencast) you'll see, that there is a lot of functionalities missing, the form data validation is still not applied to all forms and I still need to sort out the CSS layout.&amp;nbsp;The app includes &lt;strong&gt;4 temp DB tables and 4 main DB tables.&lt;/strong&gt;&amp;nbsp;I still have to work on moving data from the temp to the main tables. Will finish it when possible.&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;As already mentioned I am using the &lt;strong&gt;Scaffold plugin&lt;/strong&gt; and testing &lt;strong&gt;Wheels validation functions&lt;/strong&gt; and I even made a &lt;strong&gt;helper function&lt;/strong&gt;&amp;nbsp;that takes data from four check-boxes and display the result in an &lt;strong&gt;array list&lt;/strong&gt;. Just to try out helper functions.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;Last year, when I didn't know much about Wheels or any other CF framework I asked a friend:&lt;/div&gt;
&lt;p /&gt;
&lt;blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex;"&gt;&lt;span style="font-size:large;"&gt;&lt;span style="font-family:georgia, serif;"&gt;"Do Coldfusion frameworks have alternatives to&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;&lt;span style="font-size:large;"&gt;&lt;span style="font-family:georgia, serif;"&gt; PHP Smarty tags&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:large;"&gt;&lt;span style="font-family:georgia, serif;"&gt;?"&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;Now I know the answer. Those who are more familiar with PHP and the the &lt;a rel="nofollow" target="_blank" href="http://www.smarty.net/manual/en/what.is.smarty.php"&gt;Smarty tags&lt;/a&gt; may see a lot of similarities in Wheels helper functions. Both help us separating HTML from the scripting code, however Wheels helper functions are much more flexible and thus more powerful in my humble opinion. Still I am almost sure that every MVC based framework has it's equivalent to Smarty tags.&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;On the other hand, since I haven't been paying too much attention on this topic lately, it might just happen that maybe Smarty tags are already obsolete. &lt;strong&gt;Opinions on that topic are more than welcome. Feel free to pots your comments on that.&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex;"&gt;&lt;span style="font-family:georgia, serif;"&gt;&lt;span style="font-size:large;"&gt;"Why are those forms so important? Anyone can make a stupid form!"&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;If we get back to our forms... Well it is not just about the forms. It is the way a Wheels newbie can cope with them using some of the great features of Wheels (such as Ra&amp;uacute;l Riera's&amp;nbsp;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/9"&gt;Scaffold plugin&lt;/a&gt;). But the real message I want to get out there is how I was&amp;nbsp;able&amp;nbsp;(again - as a Wheels beginner) to comprehend so many things in such a short period of time. It's the power of the framework.&lt;strong&gt; I love conventions! :)&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;Everything about this web form, which is the topic of this post is also about learning basics of this really great Framework. If you are interested to learn what I and many others did, feel free to go on &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/screencasts"&gt;Chris Peters' screen-casts&lt;/a&gt; and learn Wheels basics by building relatively simple web forms.&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;Ok, I admit, maybe I am over-zealous, but certainly I am not biased. In any case&amp;nbsp;&lt;/strong&gt;&lt;strong&gt;I have a feeling that after 5 or 10 years we will be still talking about Wheels in a very positive way.&amp;nbsp;&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;Prior to Wheels I tried the PHP Zend Framework and to be honest I am having much more fun with Wheels than Zend. All seems so much easier and nicer in Wheels. I know that Zend is a great Framework too, that it has a big community and it has many options that I still don't know about but right now I am stuck with Wheels and I love it.&amp;nbsp;&lt;strong&gt;Isn't that the most important thing?&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;I am still leaving the door open to other Frameworks, however I will enjoy ColdFusion and Wheels as long as I can. Hopefully will even make a career from it. The signs are already here.&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;BTW, I apologize for any mistake in the text if you find it. It is just so late and I cannot see straight anymore. Feedback or comments are more than welcome!&lt;/div&gt;  &lt;p&gt;&lt;a rel="nofollow" target="_blank" href="http://combofusion.posterous.com/very-good-progress-with-my-form-application-i"&gt;Permalink&lt;/a&gt; | &lt;a rel="nofollow" target="_blank" href="http://combofusion.posterous.com/very-good-progress-with-my-form-application-i#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt; &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/f0X_gRHsQMo" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://combofusion.posterous.com/very-good-progress-with-my-form-application-i</guid>
         <pubDate>Wed, 25 Aug 2010 20:50:00 -0700</pubDate>
      </item>
      <item>
         <title>Ideas about saving form-data into multiple tables &amp; keeping functions like the errorMessagesFor() helper and validation functions in Wheels</title>
         <link>http://combofusion.posterous.com/ideas-about-saving-form-data-into-multiple-ta</link>
         <description>&lt;p&gt;&lt;div&gt;I had a rough night while trying to make an alternative validation system that would suit my needs of saving data from different forms into multiple database tables. When waking up I saw Cris Peters' email and some helpful notes in the &lt;a rel="nofollow" target="_blank" href="http://groups.google.com/group/cfwheels/browse_thread/thread/7ae1d71787c6de6d"&gt;CF On Wheels Google group&lt;/a&gt;.&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;Here is the main part of our latest discussion. I am posting it because there are some nice ideas thrown on the the table. Chris had some nice suggestions about the way I should approach my problem and I also came up with some interesting ideas. I am more than happy to share them with you, as feedback would be mostly appreciated, so please feel free to post comments and your ideas!&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;The quotes in this posts belong to Chris Peters.&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex;"&gt;&lt;span style="font-family:georgia, serif;"&gt;&lt;span style="font-size:large;"&gt;"For the foreseeable future, validation functions are only available when&amp;nbsp;saving to the database."&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;That's why I was thinking to solve my problem by adjusting myself to that. Since I think that those validation functions are sent from heaven :), I really want to keep the functionality. I really want to use them. In the last project I made in PHP, I was busting my ass to make sure the validation works as it should, so I really want to use those functions! :) So my idea now is to save the choir form data in sections, thus for each section having a DB table on it's own. &lt;strong&gt;However this may not be the best solution, because in this case we we would have more database tables than we maybe should. But on the other hand, does this really matters?&lt;/strong&gt; I don't know... My idea was to have temporary tables that would be used as temporary containers... instead of using the session scope for that purpose, we could save the temporary data into temporary tables which would enable to access the data also after loosing the sessions!&amp;nbsp;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;That may sound funny, but I am sure it wouldn't be the first time that someone makes it this way. However I know that once we will be able to use NestedProperties(), things won't be so complicated anymore.&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;div&gt;BTW, about the NestedProperties() function. Here is what halfFAST wrote:&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;&lt;em&gt;"&lt;span style="font-family:arial, sans-serif;font-size:12px;"&gt;Nested properties are coming in 1.1... you'll need to be running code&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:arial, sans-serif;font-size:12px;"&gt;right from the svn repo to try them out as there is no release that&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:arial, sans-serif;font-size:12px;"&gt;supports nested properties out yet.&amp;nbsp;&lt;/span&gt;"&lt;/em&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;Raul also wrote:&lt;/div&gt;
&lt;blockquote&gt;
&lt;div&gt;&lt;em&gt;&lt;span style="font-family:arial, sans-serif;font-size:12px;"&gt;"SVN is subversion control, where Wheels code lives :)&amp;nbsp;&lt;a rel="nofollow" target="_blank" href="http://www.google.com/url?sa=D&amp;amp;q=http://code.google.com/p/cfwheels/&amp;amp;usg=AFQjCNETBNiiCgovLyPmro2B1282sxpkPw" style="color:#0000cc;"&gt;http://code.google.com/p/cfwheels/&lt;/a&gt;.&amp;nbsp;&amp;nbsp;You can go into the "source" section and everything under the folder "&lt;/span&gt;&lt;span style="font-family:arial, sans-serif;font-size:12px;"&gt;trunk" is what is called the bleeding edge code of ColdFusion on&amp;nbsp;&lt;/span&gt;&lt;span style="font-family:arial, sans-serif;font-size:12px;"&gt;heels (in other words the upcoming 1.1 version)&amp;nbsp;&lt;/span&gt;"&lt;/em&gt;&lt;/div&gt;
&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;&lt;span style="font-size:large;"&gt;So let me explain a little bit more how I was thinking to use those sections and the "temp" tables.&lt;/span&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;1. "Main info" section&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;This section would have only a couple of input fields in the form. This form would be the first thing that a user would see when clicking the &lt;strong&gt;"Add choir"&lt;/strong&gt; button in the administration. It would have the fields: &lt;strong&gt;"Choir title"&lt;/strong&gt; (textfield),&lt;strong&gt; "Type of choir"&lt;/strong&gt; (select), &lt;strong&gt;"Date of the Choir Establishment"&lt;/strong&gt; (calendar or select), &lt;strong&gt;"Number of singers"&lt;/strong&gt; (select). This form, or this section would be mainly used for creating a new record, with a new main record ID in the database. Once the user would fill up those 4 forms (4 sections) we would just save() the data into a DB table named &lt;strong&gt;"tempchoirs"&lt;/strong&gt; (I hope this name follows the Wheels conventions. Does it?), which would allow us to use both the form validation functions and the errorMessagesFor() helper function. Now we would have the ID of the newely inserted choir, which we would use in the following sections (steps of the form) as a foreign key, to connect the whole choir record (all 4 temp tables).&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;2. "Address" Section&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;After saving the data in the first section of the form, we would have the "tempchoirs" table filled with a new record and we would be redirected to the second step of the form - to the "&lt;strong&gt;Address"&lt;/strong&gt; section. Actually we would be redirected to a new action, which would use the same controller. This section would have around 4 or 5 form fields for the address data (city, house number, post-office number...) and would save the filled data into the second-section DB table named "tempadresses".&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;The procedure would be the same also in the &lt;strong&gt;"Formal info"&lt;/strong&gt; section (data would be stored in the &lt;strong&gt;"tempchoirinformation"&lt;/strong&gt; DB table) and in the &lt;strong&gt;"Extra infro"&lt;/strong&gt; section (data would be stored in the &lt;strong&gt;"tempextrachoirinformation"&lt;/strong&gt; DB table).&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;span style="font-size:large;"&gt;Now, here is the important part!&lt;/span&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;After filling up and checking the data of all 4 sections, the user would click&lt;strong&gt; "Save record"&lt;/strong&gt; and the information would be moved f&lt;strong&gt;rom the temporary DB tables to the main tables&lt;/strong&gt;: "choirs", "addresses", "choirinformation" and "extrachoirinformation".&amp;nbsp;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;The information from the DB tables would move (copy and delete) in this way:&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;tempchoirs -&amp;gt; choirs&lt;/div&gt;
&lt;div&gt;tempaddresses -&amp;gt; addresses&lt;/div&gt;
&lt;div&gt;tempchoirinformation -&amp;gt; choirinformation&amp;nbsp;&lt;/div&gt;
&lt;div&gt;tempextrachoirinformation - &amp;gt; extrachoirinformation&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;Probably you were asking yourself...&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;"What happens after the user stops on the second step of the form? Do we have only one temp table filled?"&lt;/strong&gt;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;&lt;strong&gt;Yes! Why not?&lt;/strong&gt; This can also have it's benefits and it certainly doesn't affect the user at all. Let's say that the user comes back after a few hours and wants to insert it's choir again from the beginning (step 1). Once he or she would start filling the form, the app could suggest names of the choirs that were not finished filling up and! Maybe by using Ajax.&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;div&gt;IMHO this whole scenario may be useful because in this way we would certainly keep the functionality of the form validation functions and the errorMessagesFor() helper function. Also this may be a good idea, or a good method for some future Wheels versions. Or we could use this idea to make a new plugin perhaps? Hm... :)&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex;"&gt;&lt;span style="font-size:large;"&gt;&lt;span style="font-family:georgia, serif;"&gt;"What I suggest is running the validations before storing the new data in the&amp;nbsp;session."&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;Well, this is what I was trying to do actually, but in the process I lost the functionality of the validation functions. I hope what you are suggesting really works! Have you been using this system in your apps?&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex;"&gt;&lt;span style="font-size:large;"&gt;&lt;span style="font-family:georgia, serif;"&gt;"That way you can validate that everything is OK before "committing"&amp;nbsp;to the session scope."&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;Exactly! Validating before even saving to the session scope would be even better!&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:#cccccc;border-left-style:solid;padding-left:1ex;"&gt;&lt;span style="font-size:large;"&gt;&lt;span style="font-family:georgia, serif;"&gt;"As for displaying error messages, there are a lot of ways to skin that cat.&amp;nbsp;I happen to like the simplicity of errorMessagesFor()."&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;
&lt;p /&gt;
&lt;div&gt;Exactly! I would be glad if we could keep this function working in every scenario. :)&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;div&gt;So, to wrap up I this post I want to say that ever since I started using ColdFusion a year ago I always said that this community is the best. However we could freely add the Wheels community to that statement. :) Thank you guys for helping. It is very nice to know that there is someone to ask for help, especially after a long night unsuccessfully to solve your problem.&amp;nbsp;&lt;/div&gt;
&lt;p /&gt;
&lt;div&gt;I encourage everyone to post your comments and feedback!&lt;/div&gt;  &lt;p&gt;&lt;a rel="nofollow" target="_blank" href="http://combofusion.posterous.com/ideas-about-saving-form-data-into-multiple-ta"&gt;Permalink&lt;/a&gt; | &lt;a rel="nofollow" target="_blank" href="http://combofusion.posterous.com/ideas-about-saving-form-data-into-multiple-ta#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt; &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/A-5V2oCWYYY" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://combofusion.posterous.com/ideas-about-saving-form-data-into-multiple-ta</guid>
         <pubDate>Mon, 23 Aug 2010 06:01:00 -0700</pubDate>
      </item>
      <item>
         <title>How to properly save form data to multiple DB tables and still sticking to CFWheels conventions</title>
         <link>http://combofusion.posterous.com/how-to-properly-save-form-data-to-multiple-db</link>
         <description>&lt;p&gt;&lt;p&gt;Since I've been neglecting ColdFusion and this blog for almost a year now (I wish I had a choice... have been too busy with other stuff), I guess it's finally time for one more post. &lt;p /&gt;I am now super excited to finally going along with everything that ColdFusion has to offer. After the first time I got across and installed a CF Framework (CF on Wheels) I am now happily discovering all the possibilities that a CF Framework throws on the plate for us.&lt;p /&gt; Since I first came across CFWheels (a year ago) the guys at the &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/"&gt;CFWheels official site&lt;/a&gt; have been working hard and made many improvements that got me all excited. Chris Peters also made some excellent &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/screencasts"&gt;Screencasts&lt;/a&gt; you might check out.&lt;p /&gt; This blog post however is more a cry for help rather than giving advice. If anyone can read this (the text below) and point me to the right direction with useful advice I would really appreciate it!&lt;p /&gt;I will explain what I was dealing with and also how I solved the problem. My objective now is to do a similiar thing within the CFWheels framwork. If anyone has a better idea I would kindly like to ask you to share it with me by commenting under this blog post or send me a personal message.&lt;p /&gt; Here we go... I posted this also in the &lt;a rel="nofollow" target="_blank" href="http://groups.google.com/group/cfwheels/browse_thread/thread/7ae1d71787c6de6d"&gt;CFWheels Google Group&lt;/a&gt;. &lt;p /&gt;
&lt;blockquote class="gmail_quote" style="border-left:1px solid #cccccc;margin:0pt 0pt 0pt 0.8ex;padding-left:1ex;"&gt;Before I start I would like to point out that this topic relates to this one: &lt;a rel="nofollow" target="_blank" href="http://groups.google.com/group/cfwheels/browse_thread/thread/b11a5f79.."&gt;http://groups.google.com/group/cfwheels/browse_thread/thread/b11a5f79..&lt;/a&gt;..&lt;p /&gt; Recently I've been working on a system (in PHP) that saves data from a quite complicated (many input fields) web-form into 4 different MySQL tables. When you pressed the save button below the form, I created a MD5 unique ID, so each record would have one.&lt;p /&gt; Now I want to apply a similiar problem into CF, using the CFWheels Framework, but as a Wheels newbie I would first like to know if there is an easier and quicker way to do it in Wheels. I know that Wheels makes things easier and I would like to know if I there is a conventional way in Wheels to do that.&lt;p /&gt; Let's go back to my PHP solution, to explain my system...&amp;nbsp; Since in the form I have 4 different sections ("Choir" section, "Choir Master" section, "Choir President" section and "Competition details" section) that should be stored each in its own DB table I connected all 4 section-records with one Unique ID. I obviously stored the data into 4 different session structs / arrays (like... session.myArray1, session.myArray2...) and each of them had the same MD5 unique ID stored as well.&lt;p /&gt; By using the same unique ID, stored in all 4 tables I could pull one record with the same unique ID from those 4 tables at any time.&lt;p /&gt;So what I did was, not to have normal foreign keys at we usually do. Instead I could get data of one record from all 4 tables simply by referencing each table with a unique ID that was stored in each table.&lt;p /&gt; Now I am using Wheels (testing it the past few days) and I was thinking to apply this system to my CF project, but I am not sure if there are any Wheels conventions that help me to do this in an easier way.&lt;p /&gt;Here is a screencast I just made to show you what I want to do.&lt;p /&gt; 
 
 
&lt;iframe class="embeddedvideo" src="http://screenr.com/Content/assets/screenr_1116090935.swf" height="308" width="500"&gt;&lt;/iframe&gt;
 
. &lt;p /&gt;Here I am trying to savi data from a form into two different DB tables.&lt;p /&gt;Now with Wheels I have the idea to first save the data of the Choir form into a session, where I also save a unique ID. After that the user could maybe fill up the Address form which would also be saved in the session, having the same unique ID that I just made when saving the choir data first.&lt;p /&gt; OK, I know my explanation may not be the best, so if anyone wants to help me here, I will gladly explain if you don't understand something that I wrote or said in the Screencast.&lt;p /&gt;Thank you in advance.&lt;/blockquote&gt;  &lt;p&gt;&lt;a rel="nofollow" target="_blank" href="http://combofusion.posterous.com/how-to-properly-save-form-data-to-multiple-db"&gt;Permalink&lt;/a&gt; | &lt;a rel="nofollow" target="_blank" href="http://combofusion.posterous.com/how-to-properly-save-form-data-to-multiple-db#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt; &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/sFVO252eX4s" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://combofusion.posterous.com/how-to-properly-save-form-data-to-multiple-db</guid>
         <pubDate>Sun, 22 Aug 2010 09:00:00 -0700</pubDate>
      </item>
      <item>
         <title>Learning CFWheels – CRUD and My All-in-One View</title>
         <link>http://kwbarrett.wordpress.com/2010/08/19/learning-cfwheels-crud-and-my-all-in-one-view/</link>
         <description>In a previous life, I was a Fusebox 4.1 developer. We had a pretty standard way of making an interface for Creating, Retrieving, Updating, and Deleting records. All records would be displayed in a table, the last column of which was called the actions column. In this column, next to each record would be links [...]&lt;img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kwbarrett.wordpress.com&amp;amp;blog=1166602&amp;amp;post=250&amp;amp;subd=kwbarrett&amp;amp;ref=&amp;amp;feed=1" width="1" height="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/r8BrQY8vbm4" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://kwbarrett.wordpress.com/?p=250</guid>
         <pubDate>Thu, 19 Aug 2010 18:46:40 -0700</pubDate>
         <media:content url="http://1.gravatar.com/avatar/592c13df5d497f5527bcaebf643220d5?s=96&amp;amp;d=identicon&amp;amp;r=G" medium="image">
            <media:title>kwbarrett</media:title>
         </media:content>
         <media:content url="http://kwbarrett.files.wordpress.com/2010/08/screen-shot-2010-08-19-at-9-06-35-pm.png" medium="image">
            <media:title>add_edit_delete_interface</media:title>
         </media:content>
      </item>
      <item>
         <title>CFWheels Full Stack (Why all the downloads then?)</title>
         <link>http://www.henke.ws/post.cfm/cfwheels-full-stack-why-all-the-download-then</link>
         <description>&lt;p&gt;Wheels is mentioned as a full stack framework sometimes. What does "full stack" mean? Full stack frameworks "often gathered multiple libraries useful for &lt;a rel="nofollow" title="Web development" target="_blank" href="http://en.wikipedia.org/wiki/Web_development"&gt;web development&lt;/a&gt; into a single cohesive &lt;a rel="nofollow" class="mw" title="Software stack" target="_blank" href="http://en.wikipedia.org/wiki/Software_stack"&gt;software stack&lt;/a&gt; for web developers to use." The quote is from &lt;a rel="nofollow" target="_blank" href="http://en.wikipedia.org/wiki/Web_application_framework"&gt;http://en.wikipedia.org/wiki/Web_application_framework&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can get started with Wheels without any downloads/plugins. After you get familiar with Wheels, you may want to check plugins out. Like most things with Wheels, you don't have to learn everything at once. It can be on your own time line.&lt;/p&gt;
&lt;p&gt;If Wheels is a single cohesive stack, why all the downloads/plugins? Well, as great as &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/community/core-team"&gt;the Wheels core team&lt;/a&gt; is they may not have thought of everything. They may even have a different idea from what you think some Wheels function's parameters should be and what it should do. &lt;/p&gt;
&lt;p&gt;Plugins allow you, the Wheels framework user, to modify or enhance Wheels functionality. Some plugins may eventually get incoroporated in Wheels like the Flash Helper mentioned below. Some plugins may be niche like the Oracle Auto increment plugin and not necessary to be added to the framework but are useful anyways. &lt;/p&gt;
&lt;p&gt;Below is a list of some of the many plugins created by Wheels users. The full selection is here &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/"&gt;http://cfwheels.org/plugins/&lt;/a&gt;. &lt;/p&gt;
&lt;a rel="nofollow" id="internal-source-marker_0.39658189518377185" name="internal-source-marker_0.39658189518377185" target="_blank" href="http://cfwheels.org/plugins/listing/4"&gt;Asset Bundler&lt;/a&gt; Version 1.0.1&lt;br&gt;A plugin that combines and minifies your javascript and css code. &lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/4"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/33"&gt;DatabaseViews&lt;/a&gt; Version 0.3&lt;br&gt;Adds support for database views &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/33"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/28"&gt;DBMigrate&lt;/a&gt; Version 0.4&lt;br&gt;This plugin adds Database Migration functionality to CFWheels similar to Rails' Active Record migrations. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/28"&gt;Download&lt;/a&gt; &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/4"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/10"&gt;Flash Helpers&lt;/a&gt; Version 0.4&lt;br&gt;Handle with ease Wheels "flash" system &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/10"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt; &lt;a rel="nofollow" id="internal-source-marker_0.39658189518377185" name="internal-source-marker_0.39658189518377185" target="_blank" href="http://cfwheels.org/plugins/listing/36"&gt;Oracle Auto Increment&lt;/a&gt; Version 0.1&lt;br&gt;Simulates Auto Increment primary key field for Oracle using sequences &lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/36"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt; &lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/8"&gt;PluginManager&lt;/a&gt; Version 0.9&lt;br&gt;Browse and download authorized plugins directly from your local Wheels install. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/8"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/6"&gt;Provides&lt;/a&gt; Version 0.2&lt;br&gt;The Provides Plugin lets you manage the data format returned by your Wheels controller. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/6"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/9"&gt;Scaffold&lt;/a&gt; Version 0.6&lt;br&gt;Add scaffolding to your Wheels applications. It will enable you to quickly create Controllers, Models and Views. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/9"&gt;Download&lt;/a&gt; &lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/6"&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/30"&gt;UploadFiles&lt;/a&gt; Version 0.1.1&lt;br&gt;This plugin tries to make uploading files to your CFWheels application easy and secure &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/30"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/20"&gt;WordArt&lt;/a&gt; Version 0.6&lt;br&gt;WordArt CFC generates image for insertion of typography on a webpage by converting text to image in various styles. There are over 25 different options available in this first release of WordArt. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/20"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;br&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/listing/16"&gt;YM_Google-Analytics&lt;/a&gt; Version 0.1&lt;br&gt;YM_Google-Analytics helps you easily track website statistics within your application using Google Analytics' service. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org/plugins/download/16"&gt;Download&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/a1YA7Eq72YI" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://www.henke.ws/post.cfm/cfwheels-full-stack-why-all-the-download-then</guid>
         <pubDate>Thu, 19 Aug 2010 04:35:49 -0700</pubDate>
      </item>
      <item>
         <title>Learning CFWheels – Keeping it DRY with Partials</title>
         <link>http://kwbarrett.wordpress.com/2010/08/17/learning-cfwheels-keeping-it-dry-with-partials/</link>
         <description>I&amp;#8217;m relatively new to CFWheels, but not CF. In my fusebox days, I would use the same form for both the create and edit, living by the credo DRY(don&amp;#8217;t repeat yourself). I would simply add logic that checks to see if the id is greater-than zero. If yes, it&amp;#8217;s an update, otherwise it&amp;#8217;s an insert. [...]&lt;img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kwbarrett.wordpress.com&amp;amp;blog=1166602&amp;amp;post=243&amp;amp;subd=kwbarrett&amp;amp;ref=&amp;amp;feed=1" width="1" height="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/aVrVHeaohq4" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://kwbarrett.wordpress.com/?p=243</guid>
         <pubDate>Tue, 17 Aug 2010 18:59:24 -0700</pubDate>
         <media:content url="http://1.gravatar.com/avatar/592c13df5d497f5527bcaebf643220d5?s=96&amp;amp;d=identicon&amp;amp;r=G" medium="image">
            <media:title>kwbarrett</media:title>
         </media:content>
      </item>
      <item>
         <title>Scaffold Plugin for CFWheels</title>
         <link>http://kwbarrett.wordpress.com/2010/08/17/scaffold-plugin-for-cfwheels/</link>
         <description>I recently stumbled upon the Scaffold plugin for CFWheels. While I was aware of scaffolding for RoR, I was pleased to find it for CFWheels. It allows me to quickly create the routine CRUD functions and get on to solving more complex issues. It can also serve as a basic prototyping or wireframing tool.&lt;img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kwbarrett.wordpress.com&amp;amp;blog=1166602&amp;amp;post=237&amp;amp;subd=kwbarrett&amp;amp;ref=&amp;amp;feed=1" width="1" height="1"/&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/-ex2OZvngDA" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://kwbarrett.wordpress.com/?p=237</guid>
         <pubDate>Tue, 17 Aug 2010 11:56:57 -0700</pubDate>
         <media:content url="http://1.gravatar.com/avatar/592c13df5d497f5527bcaebf643220d5?s=96&amp;amp;d=identicon&amp;amp;r=G" medium="image">
            <media:title>kwbarrett</media:title>
         </media:content>
         <media:content url="http://kwbarrett.files.wordpress.com/2010/08/cfwheels_debug.png?w=300" medium="image">
            <media:title>cfwheels_debug</media:title>
         </media:content>
      </item>
      <item>
         <title>Increasing the request timeout on errors</title>
         <link>http://per.djurner.net/increasing-the-request-timeout-on-errors</link>
         <description>&lt;p&gt;&lt;p&gt;Here's a little improvement that will make it into the &lt;span style="color:#888888;"&gt;&lt;a rel="nofollow" target="_blank" href="http://cfwheels.org"&gt;ColdFusion on Wheels&lt;/a&gt;&lt;/span&gt; 1.1 release.&lt;/p&gt;
&lt;p&gt;To explain this feature I first need to tell you what happens when errors occur in your Wheels application.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;How Wheels handles an error&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Assuming you're running in production mode with the default settings and have added some CSS to the "events/onerror.cfm" file what happens is that an email is sent to you informing you of the error details and a nice error screen is displayed to the visitor.&lt;/p&gt;
&lt;p&gt;The way Wheels manages this internally is to use the &lt;tt&gt;onError&lt;/tt&gt; function that is part of the &lt;tt&gt;Application.cfc&lt;/tt&gt; file. But let's say an error happens inside the &lt;tt&gt;onError&lt;/tt&gt; function itself, what happens then?&lt;/p&gt;
&lt;p&gt;Sadly, the answer is that it displays that ugly blue/gray default CFML error page right on the screen for the visitors to see, not good!&lt;/p&gt;
&lt;p&gt;So, were we stupid enough to make it possible for errors to occur inside &lt;tt&gt;onError&lt;/tt&gt; then?! No, of course not, but there is still one situation that could cause this to happen...&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A request timeout!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Let's say you have a long running request that runs longer than the timeout specified in the CFML Administrator.&lt;/p&gt;
&lt;p&gt;When the timeout (usually 60 seconds by default) is reached for that request the &lt;tt&gt;onError&lt;/tt&gt; function will be triggered but since there is no time left in the request to do things like sending an email for example a new error will be thrown inside &lt;tt&gt;onError&lt;/tt&gt;. This usually happens on the first line in &lt;tt&gt;onError&lt;/tt&gt; that takes any significant time to process.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Our solution&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In Wheels 1.1 we are increasing the request timeout for the current request automatically as soon as &lt;tt&gt;onError&lt;/tt&gt; gets called to allow us to send the email, show your custom error page and so on. Now regardless of how long your pages run your visitors will always see your custom error page and you will get an email with the error details.&lt;/p&gt;
&lt;p&gt;We are setting the request timeout to 70 seconds by default (since the default is usually 60 and adding 10 more seconds is plenty of time to perform the Wheels error handling). However if your server is set to a different request timeout than 60 seconds you should adjust this value accordingly. This is done by setting the &lt;tt&gt;onErrorRequestTimeout&lt;/tt&gt; value in one of the configuration files.&lt;/p&gt;
&lt;p&gt;For example if your request timeout is 120 seconds you can set the &lt;tt&gt;onErrorRequestTimeout&lt;/tt&gt; inside "config/settings.cfm" to 130 seconds like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt; set(onErrorRequestTimeout=130); &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Hopefully this was an interesting insight into some of the Wheels 1.1 internals, even for those of you who never have any problems with long running requests.&lt;/p&gt;  &lt;p&gt;&lt;a rel="nofollow" target="_blank" href="http://per.djurner.net/increasing-the-request-timeout-on-errors"&gt;Permalink&lt;/a&gt; | &lt;a rel="nofollow" target="_blank" href="http://per.djurner.net/increasing-the-request-timeout-on-errors#comment"&gt;Leave a comment&amp;nbsp;&amp;nbsp;&amp;raquo;&lt;/a&gt; &lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/c7tNszqU3eA" height="1" width="1"/&gt;</description>
         <guid isPermaLink="false">http://per.djurner.net/increasing-the-request-timeout-on-errors</guid>
         <pubDate>Sun, 15 Aug 2010 10:10:00 -0700</pubDate>
      </item>
      <item>
         <title>Improving the tutorial (again): including partials to DRY up forms in Wheels</title>
         <link>http://www.clearcrystalmedia.com/pm/including-partials-dry-forms-cfwheels/</link>
         <description>&lt;p&gt;This past week, &lt;a rel="nofollow" target="_blank" href="http://kwbarrett.wordpress.com/"&gt;Kenneth Barrett&lt;/a&gt; asked a question on Twitter about &lt;a rel="nofollow" target="_blank" href="http://twitter.com/kwbarrett/status/20989029404"&gt;how to DRY up his form code in ColdFusion on Wheels&lt;/a&gt;. He didn't want to have a copy of the same form across 2 view files. This is because he is a smart guy, even as a beginner! :)&lt;/p&gt;
&lt;p&gt;I linked Kenneth to a post that I wrote a year ago about &lt;a rel="nofollow" target="_blank" href="http://www.clearcrystalmedia.com/pm/same-view-multiple-actions-coldfusion-on-wheels/"&gt;combining 2 forms into a single view file&lt;/a&gt;. That approach works well for certain scenarios, but I've since changed my mind on my general preference for DRY ing up forms.&lt;/p&gt;
&lt;p&gt;Read on to see what exactly I've changed my mind on.&lt;/p&gt;</description>
         <guid isPermaLink="false">http://www.clearcrystalmedia.com/pm/?p=511</guid>
         <pubDate>Sat, 14 Aug 2010 10:39:12 -0700</pubDate>
         <content:encoded><![CDATA[<p>This past week, <a rel="nofollow" target="_blank" href="http://kwbarrett.wordpress.com/">Kenneth Barrett</a> asked a question on Twitter about <a rel="nofollow" target="_blank" href="http://twitter.com/kwbarrett/status/20989029404">how to DRY up his form code in ColdFusion on Wheels</a>. He didn&#8217;t want to have a copy of the same form across 2 view files. This is because he is a smart guy, even as a beginner! <img src='http://www.clearcrystalmedia.com/pm/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley'/> </p>
<p>I linked Kenneth to a post that I wrote a year ago about <a rel="nofollow" target="_blank" href="http://www.clearcrystalmedia.com/pm/same-view-multiple-actions-coldfusion-on-wheels/">combining 2 forms into a single view file</a>. That approach works well for certain scenarios, but I&#8217;ve since changed my mind on my general preference for DRY ing up forms.</p>
<h2>How the previous approach affects workflow</h2>
<p>Really, what&#8217;s caused my change of heart is driven by how my mind works when I&#8217;m maintaining an application. It&#8217;s important to constantly be thinking about this so we can make the boring stuff (maintenance) more efficient so we can spend more time on the fun stuff (innovation! creating new things!).</p>
<p>When I&#8217;m maintaining my Wheels application, I am sometimes in &#8220;view mode&#8221; or &#8220;data mode.&#8221; That will change the perspective on how I&#8217;m thinking about and approaching my application. If I&#8217;m in &#8220;view mode,&#8221; I&#8217;ll often start digging around in the files in the <kbd>views</kbd> folder without any regard for the CFC s stored in the <kbd>controllers</kbd> or <kbd>models</kbd> folders.</p>
<p>So if I want to change what happens on the form at <kbd>views/users/add.cfm</kbd>, that&#8217;s what I&#8217;m going to look for. Personally, I find that it&#8217;s annoying if I don&#8217;t find that particular view template and need to open the controller file to figure out what&#8217;s going on.</p>
<h2>New approach: partials</h2>
<p>Now I usually create <a rel="nofollow" target="_blank" href="http://cfwheels.org/docs/chapter/partials">partials</a> to represent the pieces of code that need to be represented across several view templates. As you&#8217;ll see, this eliminates a lot of unneeded logic in the parent view templates as well as removing the need to set up so many variables in the controller actions.</p>
<p>Here is the new <kbd>views/users/add.cfm</kbd> with a partial call:</p> <div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfparam</span> <span style="color:#0000FF;">name</span><span style="color:#0000FF;">=</span><span style="color:#009900;">"user"</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfoutput</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#000000;font-weight:bold;">h1</span><span style="color:#0000FF;">&gt;</span></span>Create a New User<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#000000;font-weight:bold;">h1</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfif</span> flashKeyExists<span style="color:#0000FF;">&#40;</span><span style="color:#009900;">"success"</span><span style="color:#0000FF;">&#41;</span><span style="color:#0000FF;">&gt;</span></span> <span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#000000;font-weight:bold;">p</span> <span style="color:#0000FF;">class</span><span style="color:#0000FF;">=</span><span style="color:#009900;">"success"</span><span style="color:#0000FF;">&gt;</span></span>#flash("success")#<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#000000;font-weight:bold;">p</span><span style="color:#0000FF;">&gt;</span></span>
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#990000;font-weight:bold;">cfif</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
#startFormTag(action="create")#
&nbsp;
<span style="color:#0000FF;">#includePartial<span style="color:#0000FF;">&#40;</span>user<span style="color:#0000FF;">&#41;</span>#</span>
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#000000;font-weight:bold;">div</span><span style="color:#0000FF;">&gt;</span></span> #submitTag(value="Create")#
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#000000;font-weight:bold;">div</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#0000FF;">#endFormTag<span style="color:#0000FF;">&#40;</span><span style="color:#0000FF;">&#41;</span>#</span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#990000;font-weight:bold;">cfoutput</span><span style="color:#0000FF;">&gt;</span></span></pre></div></div> <p>And now that I&#8217;m passing the <code>user</code> object to <code>includePartial()</code>, Wheels will auto-include the partial at <kbd>views/users/_user.cfm</kbd>:</p> <div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfparam</span> <span style="color:#0000FF;">name</span><span style="color:#0000FF;">=</span><span style="color:#009900;">"user"</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfoutput</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
#textField(objectName="user", property="name", label="Name")#
#textField(objectName="user", property="email", label="Email")#
#passwordField(objectName="user", property="password", label="Password")#
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#990000;font-weight:bold;">cfoutput</span><span style="color:#0000FF;">&gt;</span></span></pre></div></div> <p>This is a lot simpler than what I had morphed the view template into in my <a rel="nofollow" target="_blank" href="http://www.clearcrystalmedia.com/pm/same-view-multiple-actions-coldfusion-on-wheels/">original refactoring</a>. There were way too many parameters, abstractions, and pieces of logic to unpack each time I revisited the template. Yuck!</p>
<p>So now I can change the template at <kbd>views/users/edit.cfm</kbd> to also include the partial and proudly display the other elements that make it unique in its own separate template (which includes a different <code>&lt;h1&gt;</code>, form action, button label, and the need to also provide a hidden field for <code>id</code>):</p> <div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfparam</span> <span style="color:#0000FF;">name</span><span style="color:#0000FF;">=</span><span style="color:#009900;">"user"</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfoutput</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#000000;font-weight:bold;">h1</span><span style="color:#0000FF;">&gt;</span></span>Edit User<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#000000;font-weight:bold;">h1</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfif</span> flashKeyExists<span style="color:#0000FF;">&#40;</span><span style="color:#009900;">"success"</span><span style="color:#0000FF;">&#41;</span><span style="color:#0000FF;">&gt;</span></span> <span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#000000;font-weight:bold;">p</span> <span style="color:#0000FF;">class</span><span style="color:#0000FF;">=</span><span style="color:#009900;">"success"</span><span style="color:#0000FF;">&gt;</span></span>#flash("success")#<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#000000;font-weight:bold;">p</span><span style="color:#0000FF;">&gt;</span></span>
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#990000;font-weight:bold;">cfif</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
#startFormTag(action="update")#
&nbsp;
<span style="color:#0000FF;">#includePartial<span style="color:#0000FF;">&#40;</span>user<span style="color:#0000FF;">&#41;</span>#</span>
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#000000;font-weight:bold;">div</span><span style="color:#0000FF;">&gt;</span></span> #hiddenField(objectName="user", property="id")# <span style="color:#0000FF;">#submitTag<span style="color:#0000FF;">&#40;</span><span style="color:#0000FF;">&#41;</span>#</span>
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#000000;font-weight:bold;">div</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#0000FF;">#endFormTag<span style="color:#0000FF;">&#40;</span><span style="color:#0000FF;">&#41;</span>#</span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#990000;font-weight:bold;">cfoutput</span><span style="color:#0000FF;">&gt;</span></span></pre></div></div> <p>What does the controller code look like then? Well, now it&#8217;s back to the simplicity from the original tutorial:</p> <div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cffunction</span> <span style="color:#0000FF;">name</span><span style="color:#0000FF;">=</span><span style="color:#009900;">"add"</span><span style="color:#0000FF;">&gt;</span></span> <span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfset</span> user <span style="color:#0000FF;">=</span> model<span style="color:#0000FF;">&#40;</span><span style="color:#009900;">"user"</span><span style="color:#0000FF;">&#41;</span>.new<span style="color:#0000FF;">&#40;</span><span style="color:#0000FF;">&#41;</span><span style="color:#0000FF;">&gt;</span></span>
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#990000;font-weight:bold;">cffunction</span><span style="color:#0000FF;">&gt;</span></span>
&nbsp;
<span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cffunction</span> <span style="color:#0000FF;">name</span><span style="color:#0000FF;">=</span><span style="color:#009900;">"edit"</span><span style="color:#0000FF;">&gt;</span></span> <span style="color:#333333;"><span style="color:#0000FF;">&lt;</span><span style="color:#990000;font-weight:bold;">cfset</span> user <span style="color:#0000FF;">=</span> model<span style="color:#0000FF;">&#40;</span><span style="color:#009900;">"user"</span><span style="color:#0000FF;">&#41;</span>.findByKey<span style="color:#0000FF;">&#40;</span>params.key<span style="color:#0000FF;">&#41;</span><span style="color:#0000FF;">&gt;</span></span>
<span style="color:#333333;"><span style="color:#0000FF;">&lt;/</span><span style="color:#990000;font-weight:bold;">cffunction</span><span style="color:#0000FF;">&gt;</span></span></pre></div></div> <p>Hooray for simplicity!</p>
<h2>Experience is the best teacher</h2>
<p>Sometimes you don&#8217;t really know how to handle some of these scenarios until you&#8217;ve played around with them a little. My <a rel="nofollow" target="_blank" href="http://www.clearcrystalmedia.com/pm/same-view-multiple-actions-coldfusion-on-wheels/">first approach</a> (the one I&#8217;m criticizing in this tutorial) is certainly a valid one and may make sense in certain scenarios, perhaps outside the context of forms.</p>
<p>I encourage you to try different approaches and share them with others so we can keep an open discussion about best practices. It takes a little humility to openly admit that I went down the wrong path earlier, but I hope that you will find some value in this discussion.</p><img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/Hfeq7ChBbds" height="1" width="1"/>]]></content:encoded>
         <category>ColdFusion on Wheels</category>
      </item>
      <item>
         <title>Coldfusion on Wheels (cfwheels) 1.1 release - Plugin Injection Performance Improved</title>
         <link>http://iamjamesgibson.com/weblog/item/coldfusion-on-wheels-cfwheels-11-release-plugin-injection-performance-improved</link>
         <description>As with all frameworks, performance is a big part of what makes a framework great. With my ongoing work on Reservoir, we ran into an issue with wheels plugin performance. We ran into this problem because we use so many plugins. Right now, Reservoir uses 32 different plugins to enhance the functionality of wheels or to add new functionality that we needed specifically for the application. [More]&lt;img src="http://feeds.feedburner.com/~r/cfwheels/bloggers/~4/MKxZugO2gd0" height="1" width="1"/&gt;</description>
         <author>James Gibson</author>
         <guid isPermaLink="false">http://iamjamesgibson.com/weblog/item/coldfusion-on-wheels-cfwheels-11-release-plugin-injection-performance-improved</guid>
         <pubDate>Fri, 13 Aug 2010 13:54:00 -0700</pubDate>
      </item>
   </channel>
</rss><!-- fe6.pipes.re3.yahoo.com uncompressed/chunked Thu Sep  2 14:59:19 PDT 2010 -->
