<?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>thecrumb.com &#187; ColdFusion</title>
	<atom:link href="http://thecrumb.com/tag/coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://thecrumb.com</link>
	<description>developer &#124; thinker &#124; tinkerer</description>
	<lastBuildDate>Sat, 04 Feb 2012 01:28:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How I Get Started in ColdFusion</title>
		<link>http://thecrumb.com/2011/08/01/how-i-get-started-in-coldfusion/</link>
		<comments>http://thecrumb.com/2011/08/01/how-i-get-started-in-coldfusion/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 13:08:12 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1569</guid>
		<description><![CDATA[I spent many years working in the Engineering Industry as a CAD (Computer Aided Design/Drafting) Operator while tinkering with computers as a hobby in the evenings. I had tinkered with programming on my Commodore 64 and later with BASIC but &#8230; <a href="http://thecrumb.com/2011/08/01/how-i-get-started-in-coldfusion/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I spent many years working in the Engineering Industry as a CAD (Computer Aided Design/Drafting) Operator while tinkering with computers as a hobby in the evenings.  I had tinkered with programming on my Commodore 64 and later with BASIC but was always more interested in the hardware side of things.</p>
<p>In 1995, while working at the engineering firm of Clark, Richardson and Biskup, I was given the opportunity to become a Network Administrator. They were a Mac shop and I was the only person who knew anything about PCs.  I learned lots of things about networking, CAT5 cabling, Novell (!), keeping users happy and the importance of daily backups.  During this time I also became intrigued with the “World Wide Web” and began teaching myself HTML.<br />
<span id="more-1569"></span><br />
While I developed my own &#8216;blog&#8217; (at the time a lot of static pages), I also volunteered for a local animal rescue group who had a static one page site and soon began making it dynamic using Perl. At work I began creating what would later be called an &#8216;intranet&#8217;.  I was using Perl there as well but two new languages caught my eye: ASP and Cold Fusion.</p>
<p>Researching both I immediately gravitated to Cold Fusion.  It was tag based (just like HTML) and comparing code samples it seemed like a no brainer. What took 3-4 lines in Cold Fusion was 10-15 lines in ASP. Why would anyone want to write <em>MORE</em> code?  Armed with my fresh copy of Homesite 1.0 I was ready.  I soon began doing more and more web development and less and less network administration.</p>
<p>I soon developed both an intranet and external site for Clark, Richardson and Biskup build on Cold Fusion. Goodbye Perl.  I overhauled the pet rescue website and created tools to allow them to manage the content themselves.  </p>
<p>Fast forward a <em>few</em> years and I still think I made the right choice.  ColdFusion has matured nicely and I hope I have as well :)</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2011/08/01/how-i-get-started-in-coldfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ValidateThis – Day 2: Setting Up The Form</title>
		<link>http://thecrumb.com/2011/03/08/validatethis-%e2%80%93-day-2-setting-up-the-form/</link>
		<comments>http://thecrumb.com/2011/03/08/validatethis-%e2%80%93-day-2-setting-up-the-form/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 15:03:14 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[cfml]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ValidateThis]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1403</guid>
		<description><![CDATA[So you should have ValidateThis installed.  Today we&#8217;ll configure a simple form for a FAQ and add some validation rules. Before we add our form we&#8217;ll setup some things for ValidateThis.  First we&#8217;ll add the necessary jQuery libraries. There are &#8230; <a href="http://thecrumb.com/2011/03/08/validatethis-%e2%80%93-day-2-setting-up-the-form/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So you should have ValidateThis installed.  Today we&#8217;ll configure a simple form for a FAQ and add some validation rules.</p>
<p>Before we add our form we&#8217;ll setup some things for ValidateThis.  First we&#8217;ll add the necessary jQuery libraries. There are various ways to do this but here I&#8217;m using the new Asset Manager component in Model-Glue to load my .js files.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;cfset event.addJSAssetFile( &quot;validate/jquery.validate.pack.js&quot; ) /&gt;
&lt;cfset event.addJSAssetFile( &quot;validate/jquery.field.min.js&quot;  ) /&gt;
</pre>
<p>Next we need to setup our ValidateThis service. <em>getInitializationScript()</em> is going to setup our client side jQuery for us &#8211; here I&#8217;m telling it not to include the requires jQuery libraries as I&#8217;m managing that manually.  In the latest ValidateThis you don&#8217;t even have to install jQuery &#8211; it can pull the necessary files from a CDN.  <em>getValidationScript()</em> will actually look at our rules file and create the specific jQuery validation rules for our form.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;cfset validationService = event.getModelGlue().getValidationService() /&gt;
&lt;cfset event.addJSAssetCode(validationService.getInitializationScript(JSIncludes=false)) /&gt;
&lt;cfset event.addJSAssetCode(validationService.getValidationScript(objectType=&quot;faq&quot;)) /&gt;
</pre>
<p>Finally we can get a list of required fields from our rules file.  Here I am passing in my object type so ValidateThis knows what rules to apply.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;cfset variables.requiredfields = validationService.getRequiredFields(objectType=&quot;faq&quot;) /&gt;
</pre>
<p>I&#8217;m using the excellent &lt;a href=&#8221;http://cfuniform.riaforge.org/&#8221;&gt;cfUniform library&lt;/a&gt; for my forms.  Below we setup our form, and you can see I&#8217;m passing in my the &#8220;requiredFields&#8221; we defined earlier.  cfUniform will use this to flag the fields as required with an asterisk.</p>
<p>Below is my simple form.  You&#8217;ll notice there is no markup for validation rules!</p>
<pre class="brush: xml; title: ; notranslate">
&lt;uform:form action=&quot;#commitEvent#&quot;
 id=&quot;frmMain&quot;
 attributecollection=&quot;#CFUniformConfig#&quot;
 submitValue=&quot; Save FAQ &quot;
 requiredFields=&quot;#requiredFields#&quot;
 cssLoadVar=&quot;uformCSS&quot;
 jsLoadVar=&quot;uformJS&quot;&gt;

&lt;uform:fieldset&gt;
&lt;uform:field label=&quot;Question&quot;
 name=&quot;faqquestion&quot;
 type=&quot;text&quot;
 value=&quot;#faqRecord.getFaqQuestion()#&quot; /&gt;

&lt;uform:field label=&quot;Answer&quot;
 name=&quot;faqanswer&quot;
 type=&quot;textarea&quot;
 value=&quot;#faqRecord.getFaqAnswer()#&quot; /&gt;

&lt;/uform:fieldset&gt;
&lt;/uform:form&gt;
</pre>
<p>But, if we load this in our browser and view source, we&#8217;ll see our jQuery libraries loaded and then some code for ValidateThis (created by getInitializationScript()):</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;/modelglueextensions/jQuery/validate/jquery.field.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
 jQuery(document).ready(function() {
 jQuery.validator.addMethod(&quot;patterns&quot;, function(value,element,options){
 var minMatches = 1;
 var complexity = 0;
...
 , jQuery.format(&quot;&quot;)); jQuery.validator.addMethod(&quot;futuredate&quot;, function(value,element,options) { var dToday = new Date(); var dValue = new Date(value); if (options.after) { dToday = new Date(options.after); } return (dToday &lt; dValue); } , jQuery.format(&quot;&quot;));
 });
&lt;/script&gt;
</pre>
<p>If we keep scrolling we&#8217;ll see our form specific validation code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
jQuery(document).ready(function() {
$form_frmMain = jQuery(&quot;#frmMain&quot;);
$form_frmMain.validate();
if ($form_frmMain.find(&quot;:input[name='faqquestion']&quot;).length) {
 $form_frmMain.find(&quot;:input[name='faqquestion']&quot;).rules(
 &quot;add&quot;, { required : true, messages: {required: &quot;The question is required.&quot;}
 });
 ...
&lt;/script&gt;
</pre>
<p>And if we examine the form itself we&#8217;ll see our required fields (which we told cfUniform about) have been flagged with a &#8216;required&#8217; class:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;input name=&quot;faqquestion&quot; id=&quot;faqquestion&quot; type=&quot;text&quot; class=&quot;required&quot; /&gt;
</pre>
<p>Checking out the form itself we can see our required fields are marked:</p>
<div id="attachment_1410" class="wp-caption alignnone" style="width: 391px"><a href="http://thecrumb.com/wp-content/uploads/2011/03/vt-1.png"><img class="size-full wp-image-1410 " title="Required fields" src="http://thecrumb.com/wp-content/uploads/2011/03/vt-1.png" alt="" width="381" height="209" /></a><p class="wp-caption-text">Required fields</p></div>
<p>And submitting the form with empty values gives us nice, user friendly error messages:</p>
<div id="attachment_1411" class="wp-caption alignnone" style="width: 368px"><a href="http://thecrumb.com/wp-content/uploads/2011/03/vt-2.png"><img class="size-full wp-image-1411 " title="Friendly errors" src="http://thecrumb.com/wp-content/uploads/2011/03/vt-2.png" alt="" width="358" height="204" /></a><p class="wp-caption-text">Friendly errors</p></div>
<p>In the next post we will look at server side validations and adding some additional constraints to our rules file. We&#8217;ll  also explore the power of &#8216;contexts&#8217; which allow you greater control over what gets validated and when.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2011/03/08/validatethis-%e2%80%93-day-2-setting-up-the-form/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>ValidateThis &#8211; Day 1: Installation and Configuration</title>
		<link>http://thecrumb.com/2011/03/07/validatethis-day-1-installation-and-configuration/</link>
		<comments>http://thecrumb.com/2011/03/07/validatethis-day-1-installation-and-configuration/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 15:14:59 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[cfml]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ValidateThis]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1389</guid>
		<description><![CDATA[Have you heard of ValidateThis?  It&#8217;s a free, open-source validation framework for ColdFusion! ValidateThis is a framework that allows you to define validation rules for your ColdFusion objects in a single place (either an XML file, a JSON file or &#8230; <a href="http://thecrumb.com/2011/03/07/validatethis-day-1-installation-and-configuration/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Have you heard of ValidateThis?  It&#8217;s a free, open-source validation framework for ColdFusion!</p>
<blockquote><p>ValidateThis is a framework that allows you to define validation rules  for your ColdFusion objects in a single place (either an XML file, a  JSON file or in ColdFusion code) and will then generate client-side and  server-side validations for you.</p></blockquote>
<p>Hopefully you are doing server side validations for all your forms and with the various Javascript libraries making client side tasks much easier there should be no excuse there either.</p>
<p>But if you are like me you usually end up with two sets of rules, one for the server side, and one for the client.  Maintenance quickly becomes a chore, validation rules become complicated and eventually something will break or worse yet, slip through your code.</p>
<p>ValidateThis eliminates all those headaches. With a single, simple XML file you define your rules in ONE place and magically your server side AND client side validations are generated.  Business rules change? Update the XML file and you are done. Easy.<br />
<span id="more-1389"></span></p>
<h4>Installation</h4>
<p>Getting started is easy too.  Head over to <a href="http://riaforge.org/">RIAForge</a> and download <a href="http://validatethis.riaforge.org/">ValidateThis</a>.</p>
<p>Installation is well documented on the <a href="http://www.validatethis.org/docs/">ValidateThis wiki</a> (the documentation in general is outstanding) but in a nutshell:</p>
<ol>
<li>Download the framework.</li>
<li>Unzip.  Either into the webroot, or elsewhere and create a ColdFusion mapping called <em>ValidateThis</em>.</li>
<li>Copy the JavaScript files from <em>/client/jQuery/js/</em> into a folder that will be accessible by your web pages (e.g., /js/ off your web root).</li>
</ol>
<h4>Follow The Rules</h4>
<p>Next you need to define your validation rules.  Head over to the wiki and check out the <a href="http://www.validatethis.org/docs/wiki/Sample_Rules_Definition_File.cfm">Sample Rules Definition File</a>.   While the rules can get quite complicated doing simple validation is easy as this:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;property name=&quot;faqanswer&quot; desc=&quot;answer&quot;&gt;
  &lt;rule type=&quot;required&quot;/&gt;
&lt;/property&gt;
</pre>
<h4>Connect Everything</h4>
<p>Once you have your rules defined integrating ValidateThis into your application is easy.  There is documentation covering the<a href="http://www.validatethis.org/docs/wiki/Integrating_VT_with_MVC.cfm"> major frameworks</a>.  You can also pass ValidateThis a simple struct for validation.  See the docs for details.</p>
<p>I&#8217;m using Model-Glue and ColdSpring.  In my ColdSpring.xml file I define my service, configuration and validateThis beans like so:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;bean id=&quot;modelglue.ValidationService&quot; class=&quot;ValidateThis.extras.ModelGlueValidationService&quot;&gt;
	&lt;constructor-arg name=&quot;ValidateThisConfig&quot;&gt;&lt;ref bean=&quot;ValidateThisConfig&quot; /&gt;&lt;/constructor-arg&gt;
&lt;/bean&gt;
&lt;bean id=&quot;ValidateThisConfig&quot; class=&quot;coldspring.beans.factory.config.MapFactoryBean&quot;&gt;
	&lt;property name=&quot;sourceMap&quot;&gt;
		&lt;map&gt;
			&lt;entry key=&quot;JSRoot&quot;&gt;&lt;value&gt;/modelglueextensions/jquery/validate/&lt;/value&gt;&lt;/entry&gt;
			&lt;entry key=&quot;definitionPath&quot;&gt;&lt;value&gt;../model/&lt;/value&gt;&lt;/entry&gt;
		&lt;/map&gt;
	&lt;/property&gt;
&lt;/bean&gt;
&lt;bean id=&quot;ValidateThis&quot; class=&quot;ValidateThis.ValidateThis&quot;&gt;
	&lt;constructor-arg name=&quot;ValidateThisConfig&quot;&gt;&lt;ref bean=&quot;ValidateThisConfig&quot; /&gt;&lt;/constructor-arg&gt;
&lt;/bean&gt;
</pre>
<p>I&#8217;m also using ColdFusion 9 ORM so validating my objects is as easy as creating my object, populating it and passing it to ValidateThis:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;cfset local.faq = EntityNew('faq') /&gt;
&lt;cfset local.faq.setFaqQuestion( Trim(arguments.event.getValue('faqQuestion')) )  /&gt;
&lt;cfset local.faq.setFaqAnswer( Trim(arguments.event.getValue('faqAnswer')) )  /&gt;
&lt;cfset local.result = beans.validateThis.validate( theObject=local.faq ) /&gt;
</pre>
<p>Now we can simply check  local.result.hasErrors() and proceed with either saving our object or returning to our form with out errors.</p>
<p>This was a quick introduction&#8230; in our next post we&#8217;ll look at what we need to add to our form to get client side validation.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2011/03/07/validatethis-day-1-installation-and-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick ValidateThis Gotcha</title>
		<link>http://thecrumb.com/2011/01/27/quick-validatethis-gotcha/</link>
		<comments>http://thecrumb.com/2011/01/27/quick-validatethis-gotcha/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 14:43:58 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[ValidateThis]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1342</guid>
		<description><![CDATA[This is 100% my mistake which I&#8217;m blaming on lack of sleep and caffiene. But I thought I&#8217;d post it to help others who may run into this issue. I was writing some new ValidateThis rules and one was not &#8230; <a href="http://thecrumb.com/2011/01/27/quick-validatethis-gotcha/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is 100% my mistake which I&#8217;m blaming on lack of sleep and caffiene.</p>
<p>But I thought I&#8217;d post it to help others who may run into this issue.</p>
<p>I was writing some new <a href="http://www.validatethis.org/">ValidateThis</a> rules and one was not firing&#8230;  I assumed I was doing something wrong in my rules file so I was trying all sorts of iterations with no success.  </p>
<p>My rules looked like:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;property name=&quot;PID&quot; desc=&quot;PID&quot;&gt;
&lt;rule type=&quot;required&quot;
contexts=&quot;Coordinator&quot;
failureMessage=&quot;A PID is required if the provider is a university employee.&quot;&gt;
&lt;param name=&quot;DependentPropertyName&quot; value=&quot;employeeTypeId&quot; /&gt;
&lt;param name=&quot;DependentPropertyValue&quot; value=&quot;1&quot; /&gt;
&lt;/rule&gt;
&lt;/property&gt;
</pre>
<p>What I should have remembered  is:</p>
<ol>
<li>That ValidateThis writes both your server and client side validations (which is sooo nice!)</li>
<li> The client side is done with jQuery</li>
<li>And JavaScript is&#8230; case sensitive!</li>
</ol>
<p>So if we revisit my ValidateThis rule I had:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;property name=&quot;PID&quot; desc=&quot;PID&quot;&gt;
</pre>
<p>But in my markup (I&#8217;m using cfUniForm) I had:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;uform:field label=&quot;PID&quot; name=&quot;pid&quot; type=&quot;text&quot; ...
</pre>
<p>Doh!  Despite my best efforts PID != pid in JavaScript.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2011/01/27/quick-validatethis-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting It Out (more readable code)</title>
		<link>http://thecrumb.com/2011/01/21/sorting-it-out-more-readable-code/</link>
		<comments>http://thecrumb.com/2011/01/21/sorting-it-out-more-readable-code/#comments</comments>
		<pubDate>Fri, 21 Jan 2011 15:54:49 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[CFEclipse]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1329</guid>
		<description><![CDATA[With my latest project I&#8217;ve been dealing with big property files using ColdFusion ORM. What invariably happens is properties get added, removed and eventually you have this big file of jumbled names which is really difficult to scan through. I &#8230; <a href="http://thecrumb.com/2011/01/21/sorting-it-out-more-readable-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With my latest project I&#8217;ve been dealing with big property files using ColdFusion ORM. What invariably happens is properties get added, removed and eventually you have this big file of jumbled names which is really difficult to scan through.</p>
<p>I was tinkering with Notepad++ ( a great text editor ) and noticed it had a plugin to sort text&#8230;</p>
<pre>TextFX &gt; TextFX Tools &gt; Sort lines case sensitive (at column)</pre>
<p>This will turn</p>
<pre class="brush: plain; title: ; notranslate">
&lt;cfproperty name=&quot;submitURL&quot; ...
&lt;cfproperty name=&quot;date_applicant_signed&quot; ...
&lt;cfproperty name=&quot;special_conditions_limitations&quot;  ...
&lt;cfproperty name=&quot;chair_signature&quot; ...
&lt;cfproperty name=&quot;special_privileges&quot; ...
&lt;cfproperty name=&quot;applicant_signature_confirm&quot; ...
</pre>
<p>Into an much easier to scan:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;cfproperty name=&quot;applicant_signature_confirm&quot; ...
&lt;cfproperty name=&quot;chair_signature&quot; ...
&lt;cfproperty name=&quot;date_applicant_signed&quot; ...
&lt;cfproperty name=&quot;special_conditions_limitations&quot;  ...
&lt;cfproperty name=&quot;special_privileges&quot; ...
&lt;cfproperty name=&quot;submitURL&quot; ...
</pre>
<p>But going back and forth from CFEclipse to Notepad++ was a pain.  A quick search turned up the <a href="http://www.stateofflow.com/projects/2/sortit">Sort-It plugin</a> for Eclipse.  After installing it you should have a new menu item on the Edit menu &gt; Sort.</p>
<p>I&#8217;ve found this is really handy for sorting properties, variable declarations, CSS, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2011/01/21/sorting-it-out-more-readable-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Friendly Error Message Placement with ValidateThis</title>
		<link>http://thecrumb.com/2010/12/23/friendly-error-message-placement-with-validatethis/</link>
		<comments>http://thecrumb.com/2010/12/23/friendly-error-message-placement-with-validatethis/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 15:28:34 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[model-glue]]></category>
		<category><![CDATA[ValidateThis]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1279</guid>
		<description><![CDATA[I&#8217;m using ValidateThis for validations on my current project. If you haven&#8217;t checked out ValidateThis yet, you should! Instead of writing cumbersome validation code both for both the client AND the server side you simply write one set of rules &#8230; <a href="http://thecrumb.com/2010/12/23/friendly-error-message-placement-with-validatethis/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using <a href="http://www.validatethis.org/">ValidateThis</a> for validations on my current project. If you haven&#8217;t checked out ValidateThis yet, you should! Instead of writing cumbersome validation code both for both the client AND the server side you simply write <em>one</em> set of rules for ValidateThis.  It will then generate both client and server side validations for you.  Now you only have to maintain one set of validation rules.</p>
<p>On the client side it uses the excellent jQuery <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">validation plugin</a>, and one issue I&#8217;ve run into was error message placement when using radio or checkbox fields.</p>
<p><span id="more-1279"></span></p>
<p>By default the plugin puts the error message in an awkward location:</p>
<p><a href="http://thecrumb.com/wp-content/uploads/2010/12/bad_errormsg.png"><img class="alignnone size-full wp-image-1280" title="bad_errormsg" src="http://thecrumb.com/wp-content/uploads/2010/12/bad_errormsg.png" alt="" width="523" height="303" /></a></p>
<p>This is fairly easy to fix however&#8230;</p>
<p>The validation plugin has a LOT of options (<a href="http://docs.jquery.com/Plugins/Validation">documentation</a>) one of them being <em>errorPlacement</em>.</p>
<p>There are a few tweaks we have to make in our file for ValidateThis to make use of this new code.</p>
<p>First lets create a new jQuery script for our <em>errorPlacement</em> and wrap it in a <em>cfsavecontent</em>:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;cfsavecontent variable=&quot;validateCode&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
$(document).ready(function() {
$(&quot;#frmMain&quot;).validate({
 errorPlacement: function(error, element) {
 if ( element.is(&quot;:radio&quot;) )
 error.insertBefore( element.parents('div.ctrlHolder') );
 else if ( element.is(&quot;:checkbox&quot;) )
 error.insertBefore( element.parents('fieldset').children('div.ctrlHolder').first() );
 else
 error.insertAfter(element);
 }
 });
});
&lt;/script&gt;
&lt;/cfsavecontent&gt;
</pre>
<p>This defines our <em>errorPlacement</em> and puts a few checks in place to see if we are dealing with a checkbox, radio or normal form field.  We can then define where we want the message placed using normal jQuery syntax.   This will probably require some experimentation depending on your form layout.</p>
<p>To get ValidateThis to use our new <em>errorPlacement</em> we need to load our scripts in a particular order.</p>
<ol>
<li>First we load the jQuery validation plugin script</li>
<li>With our script in a cfsavecontent we load it next</li>
<li>Followed by ValidateThis code to load it&#8217;s rules</li>
</ol>
<pre class="brush: coldfusion; title: ; notranslate">
&lt;cfset event.addJSAssetFile( &quot;validate/jquery.validate.pack.js&quot; ) /&gt; 

&lt;cfset event.addJSAssetCode(validateCode) /&gt; 

&lt;cfset event.addJSAssetCode(event.getModelGlue().getValidationService().getInitializationScript(JSIncludes=false)) /&gt;
&lt;cfset event.addJSAssetCode(event.getModelGlue().getValidationService().getValidationScript(objectType=&quot;Form&quot;)) /&gt;
</pre>
<p>Here I am using some new features in the latest Model-Glue alpha to load my JS scripts. You could easily replace this with normal script calls.  The important thing to note is we need to load our <em>errorPlacement</em> script <strong>before</strong> we load the ValidateThis scripts.</p>
<p>If we reload our form now we can see the error message has moved to a better location:</p>
<p><a href="http://thecrumb.com/wp-content/uploads/2010/12/good_errormsg.png"><img class="alignnone size-full wp-image-1281" title="good_errormsg" src="http://thecrumb.com/wp-content/uploads/2010/12/good_errormsg.png" alt="" width="528" height="299" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2010/12/23/friendly-error-message-placement-with-validatethis/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>cfhug</title>
		<link>http://thecrumb.com/2010/11/25/cfhug/</link>
		<comments>http://thecrumb.com/2010/11/25/cfhug/#comments</comments>
		<pubDate>Thu, 25 Nov 2010 20:08:20 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[cfbuilder]]></category>
		<category><![CDATA[CFEclipse]]></category>
		<category><![CDATA[cfml]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1246</guid>
		<description><![CDATA[Adam has  a great post up today : The History Of ColdFusion Builder If you are done with your turkey I&#8217;d encourage you to go read that, I&#8217;ll wait. I&#8217;d like to clarify a few things about my post from &#8230; <a href="http://thecrumb.com/2010/11/25/cfhug/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Adam has  a great post up today : <a href="http://www.adrocknaphobia.com/post.cfm/the-history-of-coldfusion-builder">The History Of ColdFusion Builder</a></p>
<p>If you are done with your turkey I&#8217;d encourage you to go read that, I&#8217;ll wait.</p>
<p>I&#8217;d like to clarify a few things about my post from yesterday:</p>
<ol>
<li>My blog post was meant to reflect my <em>opinion</em>. I was not speaking for CFEclipse or I&#8217;d have blogged about it there (did you know we now have a blog?)  And I wasn&#8217;t attacking or slamming anyone. I apologize if it came across that way.</li>
<li>I do diddly squat on the CFEclipse project compared to the hard work folks like Denny do under the hood.  When I feel that work is being belittled  I&#8217;m going to speak up about it. More on that below.</li>
<li>I never mentioned anything about price. I have <em>no</em> problems with Adobe charging for CFBuilder.  We&#8217;ve already had that discussion.</li>
</ol>
<p>After re-reading Adam&#8217;s blog post and the white paper my only real gripe  is with some of the wording and tone in the blog post.  What irked me (<em>again this is my opinion</em>) were statements like:</p>
<blockquote><p>In just one version, ColdFusion Builder didn&#8217;t just catch up to CFEclipse, it took many steps beyond it.</p></blockquote>
<p>That is to be expected with a large team of developers and a budget. :)</p>
<blockquote><p>Professionals who make their living writing code &#8230; will  also prefer ColdFusion Builder.</p></blockquote>
<p>I think the paper could have focused more on the positives &#8211; CFBuilder is a great tool that should sell itself:  CFBuilder extension (which was a brilliant idea), RDS support, debugging, etc.</p>
<p>There was a lot of discussion which cropped up yesterday. Some of it was negative but overall there was some great insight which I&#8217;m going to be thinking about moving forward (and before  I blog again) :)</p>
<p>Today&#8217;s a day of thanks and I&#8217;d like to thank anyone who uses, or contributes to CFEclipse!</p>
<p>I&#8217;d also like to thank Adobe for supporting our beloved CFML language. Everyday I&#8217;m thankful I go to work and write ColdFusion instead of .NET.</p>
<p><a href="http://thecrumb.com/wp-content/uploads/2010/11/hugs.jpg"><img class="aligncenter size-full wp-image-1254" title="hugs" src="http://thecrumb.com/wp-content/uploads/2010/11/hugs.jpg" alt="Photo by kalandrakas" width="500" height="333" /></a></p>
<p>And next time I see Adam I&#8217;ll buy him a beer. No wait &#8211; we&#8217;re the open source project &#8211; he can buy me a beer! :)</p>
<p>Happy Thanksgiving!</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2010/11/25/cfhug/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adobe Wants Your Lunch Money. Now.</title>
		<link>http://thecrumb.com/2010/11/24/adobe-wants-your-lunch-money-now/</link>
		<comments>http://thecrumb.com/2010/11/24/adobe-wants-your-lunch-money-now/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 14:00:30 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[cfbuilder]]></category>
		<category><![CDATA[CFEclipse]]></category>
		<category><![CDATA[cfml]]></category>
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1238</guid>
		<description><![CDATA[Today Adam Lehman posted about ColdFusion Builder and CFEclipse. Think ColdFusion Builder v.1 and CFEclipse are the same? Think again. Adobe just published a new whitepaper comparing the two CFML development tools to set the record straight. In just one &#8230; <a href="http://thecrumb.com/2010/11/24/adobe-wants-your-lunch-money-now/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today Adam Lehman posted about <a href="http://www.adrocknaphobia.com/post.cfm/coldfusion-builder-and-cfeclipse">ColdFusion Builder and CFEclipse</a>.</p>
<blockquote><p>Think ColdFusion Builder v.1 and CFEclipse are the same? Think again. Adobe just published a new whitepaper comparing the two CFML development tools to set the record straight. In just one version, ColdFusion Builder didn&#8217;t just catch up to CFEclipse, it took many steps beyond it.</p></blockquote>
<p>I&#8217;ve been a avid supporter of CFEclipse for awhile and when Adobe announced they were developing their own IDE &#8211; I never saw them as a competitor. There are only two of us &#8211; why fight?  But apparently Adobe needs to bash someone and have set their sites on the geeky kid on the playground.</p>
<p><a href="http://thecrumb.com/wp-content/uploads/2010/11/geek.jpg"><img class="aligncenter size-medium wp-image-1240" title="CFEclipse vs. CFBuilder" src="http://thecrumb.com/wp-content/uploads/2010/11/geek-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p>A whitepaper? Really? You could have donated the money you spent on creating that to the CFEclipse project! :)</p>
<p>But clearly we are talking about a two different endeavors here and for Adobe to whip out white papers and comparison charts is a little unfair I think.</p>
<p>CFBuilder is built by a large team of developers.  Their full time job is to develop CFBuilder.  I met several of them at CFUnited and they are a great group who I have no doubt are passionate about their product.  But at the end of the day they are developing a commercial product for Adobe.</p>
<p>CFEclipse on the other hand is a free, open source tool that has been developed over the years by a small, passionate group of people. Many people have worked on CFEclipse over the years but over the years there is usually only one or two people actually cranking out code.</p>
<p>Currently Denny is our main programmer and he has done a <em>tremendous </em>job fixing bugs and adding features.  He&#8217;s done that while supporting his family, working a regular job, contributing to other projects and dealing with all the other &#8216;distractions&#8217; of every day life.  He does that for free.</p>
<p>So why does Adobe feel the need to pick on CFEclipse?</p>
<p>Is ColdFusion Builder a better product?</p>
<p>I don&#8217;t think a white paper is going to answer that question. CFEclipse is available to <a href="http://www.cfeclipse.org">download</a> and install for free. CFBuilder also has a <span style="text-decoration: line-through;">30</span> 60 day trial version.</p>
<p>Download them both. Try them. Write code. Then make your decision.</p>
<p>And if you like CFEclipse please consider joining our community and help us make it better.</p>
<p>But please don&#8217;t take our lunch money.</p>
<h3>The community weighs in:</h3>
<ul>
<li>Charlie Griefer &#8211; &#8220;<a href="http://charlie.griefer.com/blog/index.cfm/2010/11/25/On-ColdFusion-Builder-vs-CFEclipse-and-the-Sky-Falling">On ColdFusion Builder vs CFEclipse and the Sky Falling</a>&#8220;</li>
<li>Nicholas Tunney &#8220;<a href="http://blog.nictunney.com/2010/11/adobe-can-have-my-lunch-money.html">Adobe can have my lunch money&#8221;</a></li>
<li>Stephen Moretti  &#8220;<a href="http://nil.checksite.co.uk/index.cfm/2010/11/24/ColdFusion-Community-Rumbles-in-the-Jungle">ColdFusion Community Rumbles in the Jungle&#8221;</a></li>
<li>Lola J. Lee Beno  &#8220;<a href="http://www.knitgal.com/blog/index.cfm/2010/11/25/A-Comment-on-the-Recent-Controversy">A Comment on the Recent Controversy&#8221;</a> (this is a good one)<a href="http://www.knitgal.com/blog/index.cfm/2010/11/25/A-Comment-on-the-Recent-Controversy"><br />
</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2010/11/24/adobe-wants-your-lunch-money-now/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Would You Buy A Framework From This Man?</title>
		<link>http://thecrumb.com/2010/10/22/would-you-buy-a-framework-from-this-man/</link>
		<comments>http://thecrumb.com/2010/10/22/would-you-buy-a-framework-from-this-man/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 14:22:42 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[model-glue]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1223</guid>
		<description><![CDATA[Over the years I have tinkered with several frameworks. My first was Fusebox. I wrote an entire site for Red Storm Entertainment using the first Fusebox only to have it mothballed before it went live when they were bought by &#8230; <a href="http://thecrumb.com/2010/10/22/would-you-buy-a-framework-from-this-man/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_1224" class="wp-caption alignright" style="width: 294px"><a href="http://thecrumb.com/wp-content/uploads/2010/10/modelglue-salesman.jpg"><img class="size-full wp-image-1224" title="modelglue-salesman" src="http://thecrumb.com/wp-content/uploads/2010/10/modelglue-salesman.jpg" alt="" width="284" height="284" /></a><p class="wp-caption-text">Model Glue Salesman - Dan Wilson</p></div>
<p>Over the years I have tinkered with several frameworks.  My first was Fusebox. I wrote an entire site for <a href="http://www.redstorm.com/">Red Storm Entertainment</a> using the first Fusebox only to have it mothballed before it went live when they were bought by Ubisoft.</p>
<p>Later it was Mach-II, Fusebox 4/5 and recently I&#8217;ve dabbled with FW/1 but over the last few years I have been doing a lot of maintenance work on existing sites so there was little opportunity to create an entire site using a new framework from scratch.</p>
<p>And then there is <a href="http://www.nodans.com/">Dan Wilson</a>.</p>
<p>As you may know I co-manage our local ColdFusion user group with Dan and we have organized a few ColdFusion conferences in the past as well.</p>
<p>And Dan owns a framework*. And he likes talking about his framework.</p>
<p>How many hours did I sit in the car driving to CFUnited listening to Dan ramble on about <em>scaffolding, events, view mappings, ColdSpring, content caching</em>, yada, yada, yada?</p>
<p>At CFLunch&#8230; <em>bean injection, generic database messages, typed events, helpers</em>&#8230;. geez does this guy ever shut up?</p>
<p>CFBeer&#8230;  <em>formats, remoting, ses urls, copyToScope</em>&#8230;</p>
<p>Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh&#8230;</p>
<p>But&#8230;</p>
<p>I also know Dan is a <em>very smart guy</em>.</p>
<p>So when I started this new project and had carte blanche to do what I wanted I decided to use a framework.</p>
<p>Dan&#8217;s framework.  <a href="http://www.model-glue.com/">Model-Glue</a>.</p>
<p>So far I really enjoy it working with it.  They took the best bits of Fusebox and threw the rest away. Then they added a bunch of really cool stuff.  I&#8217;ve tinkered with scaffolding and along with ORM this allows you to whip together fully functional forms very easily while writing little code.  The <a href="http://docs.model-glue.com/">documentation</a> is thorough.  They have a &#8216;quick start&#8217; guide to get you up and running and then a more in depth &#8216;training&#8217; course.</p>
<p>I  would never recommend one framework over another.  But if you <strong>aren&#8217;t </strong>using a framework &#8211; you should be.</p>
<p>And I&#8217;d give <strong>Model-Glue</strong> a look.</p>
<p>Stay tuned &#8211; I&#8217;ll try to blog about some of my experiences getting started with Model-Glue over the next few weeks.</p>
<p><em>* Yeah I know it&#8217;s not really Dan&#8217;s framework -  humor me will ya.  Kudos to all the people who do put in a lot of hard work on the Model-Glue team!!!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2010/10/22/would-you-buy-a-framework-from-this-man/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Do You Remember Your First?</title>
		<link>http://thecrumb.com/2010/10/21/do-you-remember-your-first/</link>
		<comments>http://thecrumb.com/2010/10/21/do-you-remember-your-first/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 14:21:11 +0000</pubDate>
		<dc:creator>Jim Priest</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[orm]]></category>

		<guid isPermaLink="false">http://thecrumb.com/?p=1219</guid>
		<description><![CDATA[I can still remember my first. It was the early 90&#8242;s and I was tasked with creating an &#8220;Intranet&#8221;. Surfing around I found two solutions: Cold Fusion (yes it was originally spelled as two words) and Microsoft&#8217;s ASP. ASP was &#8230; <a href="http://thecrumb.com/2010/10/21/do-you-remember-your-first/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div id="attachment_1220" class="wp-caption alignright" style="width: 310px"><a href="http://thecrumb.com/wp-content/uploads/2010/10/feet-bed.jpg"><img class="size-full wp-image-1220" title="feet-bed" src="http://thecrumb.com/wp-content/uploads/2010/10/feet-bed.jpg" alt="" width="300" height="199" /></a><p class="wp-caption-text">Remember your first cfquery?</p></div>
<p>I can still remember my first. It was the early 90&#8242;s and I was tasked with creating an &#8220;Intranet&#8221;.</p>
<p>Surfing around I found two solutions: Cold Fusion (yes it was originally spelled as two words) and Microsoft&#8217;s ASP.</p>
<p>ASP was free!  ASP ran on our Microsoft servers!  But then I looked to see what was involved with creating a query:</p>
<h3>ASP *</h3>
<pre class="brush: plain; title: ; notranslate">

&lt;%
Dim strname
strname=request(&quot;option&quot;)
Dim objConn
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.ConnectionString=&quot;DRIVER={Microsoft Access Driver (*.mdb)};&quot; &amp; _
&quot;DBQ=c:\Documents and Settings\sarvesh\My Documents\db5.mdb&quot;
objConn.Open

dim selectsql
selectsql = &quot;SELECT * FROM first WHERE name = '&quot; &amp;  request(&quot;fname&quot;) &amp; &quot;' &quot; &amp; strname &amp; &quot; method = '&quot; &amp;  request(&quot;method&quot;)&amp;&quot;' &quot;

Dim objRS
Set objRS = objConn.Execute(selectSQL)

Do while not objRS.EOF

Response.Write &quot;&lt;U&gt;&lt;H3&gt;Name -&lt;/H3&gt;&lt;/U&gt;&quot;  &amp; objRS(&quot;name&quot;) &amp; &quot; - &quot; &amp; objRS(&quot;method&quot;)

objRS.movenext
loop
objRS.close
set objRS=nothing
objConn.close
set objConn=nothing
%&gt;
</pre>
<h3>Cold Fusion</h3>
<pre class="brush: plain; title: ; notranslate">

&lt;cfquery name=&quot;Books&quot; datasource=&quot;cfbookclub&quot;&gt;
select BookID, Title from Books
where BookID = &lt;cfqueryparam value=&quot;#url.BookID#&quot; cfsqltype=&quot;cf_sql_integer&quot;&gt;
&lt;/cfquery&gt;
</pre>
<p>The choice was easy for me! Less code to write = less work!</p>
<p>On my current project I finally have the opportunity to work with ColdFusion 9 and one of the new features I was most excited to work with was ORM, and it took me back to my first cfQuery.</p>
<p>Make a few simple changes to Application.cfc. Define some properties and then simple do:  <strong>EntityLoad(user)</strong></p>
<h3>ColdFusion 9 ORM</h3>
<pre class="brush: plain; title: ; notranslate">

EntityLoad(user)
</pre>
<p>It&#8217;s just like the first time.  You smile. One line!  I&#8217;ve just gotten started and I know you can do so much more with ORM but just this simple one liner brings back the same simplicity that originally drew me towards ColdFusion.</p>
<p>* Please don&#8217;t email me and say that&#8217;s a bogus ASP script &#8211; just trying to make an example  :)</p>
]]></content:encoded>
			<wfw:commentRss>http://thecrumb.com/2010/10/21/do-you-remember-your-first/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

