Web Trenches http://www.webtrenches.com/ Posts in the field of Web Development, focusing mostly on ColdFusion, JavaScript, and Ajax development. Maintained by Michael Sprague Mango 0.2 De-select a CFGRID row so it can be clicked again <p>One of my colleagues recently mentioned to me that he was frustrated with CFGRID because after a grid row is selected, you can&#39;t trigger an action when it is clicked again.</p><p>&nbsp;Here&#39;s the solution I found.</p><p>&nbsp;First the grid code... </p><p>&lt;cfajaxproxy bind=&quot;javascript:todetail({shipments.id})&quot; /&gt;<br />&lt;cfgrid query=&quot;sdQry&quot; name=&quot;shipments&quot; format=&quot;html&quot; autowidth=&quot;false&quot; selectonload=&quot;false&quot; style=&quot;clear:both;&quot;&gt;<br /> &lt;cfgridcolumn name=&quot;id&quot; display=&quot;no&quot; /&gt;<br />&lt;cfgridcolumn name=&quot;INVOSHIPDATEDISPLAY&quot; header=&quot;Pickup Date&quot; width=&quot;75&quot; /&gt; <br />&lt;cfgridcolumn name=&quot;INVOPONBR&quot; header=&quot;Package Nunber&quot; width=&quot;75&quot; /&gt;<br />&lt;cfgridcolumn name=&quot;INVOBLNBR&quot; header=&quot;BOL/Cust Ref&quot; width=&quot;75&quot; /&gt;<br />&lt;cfgridcolumn name=&quot;CARRNAME&quot; header=&quot;Carrier&quot; width=&quot;150&quot; /&gt;<br />&lt;cfgridcolumn name=&quot;ORIGIN&quot; header=&quot;Origin&quot; width=&quot;150&quot; /&gt;<br />&lt;cfgridcolumn name=&quot;CONSIGNEE&quot; header=&quot;Destination&quot; width=&quot;150&quot; /&gt;<br /> &lt;/cfgrid&gt;</p><p>The cfajaxproxy code sets up an event that triggers a javascript function when one of the rows is clicked on.&nbsp; However, if you click on the row again, no action will occur.&nbsp; This is because the shipments.id value does not change.</p><p>Here&#39;s the solution...</p><p>todetail = function(shipid) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ColdFusion.navigate(&#39;shipmentdetail.cfm?action=detail&amp;id=&#39; + shipid,&#39;shipmentdetails&#39;);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ColdFusion.objectCache[&#39;shipments&#39;].selectedRow=-1;<br />} </p><p>This is the JavaScript function.&nbsp; The first line is just the action that the click performs.&nbsp; In this case, it loads the results of an Ajax call in a cfdiv.&nbsp; The second line is what clears the selection in the grid so that it can be clicked again.&nbsp; By selecting a non-existent row, we reset the id value.&nbsp; The next time the row is clicked, the id changes and the javascript triggers again.</p><p>&nbsp;</p><p>&nbsp;</p> http://www.webtrenches.com/post.cfm/de-select-a-cfgrid-row-so-it-can-be-clicked-again http://www.webtrenches.com/post.cfm/de-select-a-cfgrid-row-so-it-can-be-clicked-again DefaultColdFusionWeb DevelopmentAjax Sat, 05 Apr 2008 22:14:05 GMT CFTOOLTIP tips The more I use the CF8 Ajax features, the more I like them.&nbsp; <p>CFTOOLTIP is a fairly simple tag, but you can do some fairly powerful things with it. &nbsp;</p><p><strong>TIP #1 - Styling </strong><br />You can style a cftooltip to look like a pop-up window or Netflix-style pop-up.&nbsp; Here&#39;s a small clip to put in your page and experiment with.</p><p>&lt;style type=&quot;text/css&quot;&gt;<br />&nbsp; .yui-tt {<br />&nbsp;&nbsp;&nbsp; color: #444;<br />&nbsp;&nbsp;&nbsp; font-size:110%;<br />&nbsp;&nbsp;&nbsp; border: 2px solid #EE2130;<br />&nbsp;&nbsp;&nbsp; background-color: #FFF;<br />&nbsp;&nbsp;&nbsp; padding: 10px;<br />&nbsp;&nbsp;&nbsp; width:250px;<br />&nbsp; }<br />&lt;/style&gt;</p><p><strong>&nbsp;TIP #2 - Ajax it!</strong><br />Instead of using the tooltip=&quot;my text&quot; method of displaying the tooltip, use the sourcefortooltip=&quot;&quot; attribute.&nbsp; With this, you can push in dynamic tooltips with more complex content, such as images and formatting. &nbsp; Like this...</p><p>&lt;cftooltip sourcefortooltip=&quot;myajaxcontentfile.cfm?action=getTooltip&amp;id=1&quot;&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;img xsrc=&quot;myimage.jpg&quot; mce_src=&quot;myimage.jpg&quot; /&gt;<br />&lt;/cftooltip&gt;</p><p>Then, in myajaxcontentfile.cfm, you can have it push back images, or more complex layouts and information.&nbsp; This could be drawn from a database, or just as HTML in the file.</p><p>&nbsp;</p> http://www.webtrenches.com/post.cfm/cftooltip-tips http://www.webtrenches.com/post.cfm/cftooltip-tips DefaultColdFusionAjax Sat, 01 Mar 2008 18:17:41 GMT CFFORM and CFINPUT issue <p>I&#39;ve been neglecting my blog because I have been working on several large eCommerce projects over the last two months, but I found an issue that I think is worth asking the CF community about.</p><p>With the new features in CF8, I find myself wanting to use cfform and cfinput more for binding and Ajax features, but I keep running into issues with errors generated by ColdFusion.</p><p>&nbsp;Like most developers, I like to make my code modular for use in various parts of an application.&nbsp; I have traditionally done this with forms, where I will set up a CFC that contains a method for displaying part of a form.&nbsp; This worked great when my forms were straight HTML/JavaScript.&nbsp; But take a look at this simplified example...</p><p>My CFM file...<br />&lt;cfset formlibrary = createObject(&#39;component&#39;,&#39;formlib&#39;) /&gt;<br />&lt;cfform action=&quot;myscript.cfm&quot; method=&quot;post&quot;&gt;<br />&nbsp;&nbsp;&nbsp; &lt;cfset formlib.printNameFields() /&gt;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; &lt;cfset formlib.printAddressField() /&gt;<br />&lt;/cfform&gt; </p><p>My CFC file...<br />&lt;cfcomponent&gt;<br />&nbsp;&nbsp;&nbsp; &lt;cffunction name=&quot;printNameFields&quot;&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; First name: &lt;cfinput type=&quot;text&quot; name=&quot;firstname&quot; required=&quot;yes&quot; message=&quot;First name is required.&quot; /&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; Last name: &lt;cfinput type=&quot;text&quot; name=&quot;lastname&quot; required=&quot;yes&quot; message=&quot;Last name is required.&quot; /&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; etc...<br />&nbsp;&nbsp;&nbsp; &lt;/cfcomponent&gt;<br /> &nbsp;&nbsp;&nbsp; &lt;cffunction name=&quot;printAddressFields&quot;&gt;<br /> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; Line 1: &lt;cfinput type=&quot;text&quot; name=&quot;addr1&quot;&nbsp; /&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; Line 2:&nbsp; &lt;cfinput type=&quot;text&quot; name=&quot;addr2&quot;&nbsp; /&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; etc...<br /> &nbsp;&nbsp;&nbsp; &lt;/cfcomponent&gt;<br />&lt;/cfcomponent&gt;<br /><br />This code will generate a CF error because you cannot have a CFINPUT tag that is not nested inside a CFFORM tag.&nbsp; However, if the error did not fire, the generated source code sent to the browser would work!&nbsp; The error message that ColdFusion generates isn&#39;t really an error.&nbsp; ColdFusion just doesn&#39;t understand that I am outputting the form fields from a CFC that is inside the CFFORM tag. &nbsp;</p><p>This is a simple example of the problem, but what if I also wanted to use the CF8 type=&quot;datefield&quot; CFINPUT?&nbsp; I can&#39;t have that in a CFC either.&nbsp; I also can&#39;t use any CF8 ajax binding on with CFINPUT tags. &nbsp;</p><p>&nbsp;For now, I am just putting the CFINPUT tags in the CFM file and not making the code as modular as I would like.&nbsp; It is frustrating, though, that I have to repeat code on various forms for name and address form fields.&nbsp; </p><p>Does anyone have a suggestion for this?&nbsp; Is there a way to suppress the ColdFusion error and let it just generate the code?&nbsp; Or am I missing something?&nbsp;</p> http://www.webtrenches.com/post.cfm/cfform-and-cfinput-issue http://www.webtrenches.com/post.cfm/cfform-and-cfinput-issue DefaultColdFusion Sat, 23 Feb 2008 23:36:55 GMT Ajax Features in ColdFusion 8 <p>I gave a presentation titled &quot;Introductionto Ajax Features in ColdFusion 8&quot; at the Syracuse ColdFusion User Group meeting this week.&nbsp;&nbsp; In the presentation, I covered the following.</p><ul><li>The basic layout elements that are used with Ajax</li><li>Automatic Ajax - Things that ColdFusion 8 handles for you - without needing to program any JavaScript.</li><li>Almost-Automatic Ajax - Things that require one or two lines of code, but not extensive use of JavaScript.</li><li>Manual Ajax - These are the most powerful features, but will require some JavaScript coding.</li><li>Ajax Goodies - A couple smal small features in CF8 with big impact.<br /><br /></li></ul><p>There is also a sample application that shows an employee management database interface created using all CF8 Ajax - no page reloads. &nbsp;</p><p>&nbsp;<strong>View the presentation content here...</strong></p><ul><li><a href="/ajaxpreso/slides/" target="_blank" title="Intro to Ajax Presentation">Presentation</a> (done with CFPRESENTATION, another CF8 feature) <br /></li><li><a href="/ajaxpreso/samples" target="_blank" title="Intro to Ajax Samples">Code Samples<br /><br /></a></li></ul><p><strong>Download all the code, including the presentation code ...</strong></p><ul><li><a href="/ajaxpreso/ajaxpreso.zip" target="_blank" title="Full Code">Full Download</a> of Samples, Sample Application, and Presentation <br /><br /></li></ul>NOTE: In order to run the samples on your server, you will need ColdFusion 8.&nbsp; A couple of the samples, including the full application, require MySQL (or another database).&nbsp; Run the ajaxpreso.sql file (included) on your MySQL database and set up a CF DSN called &#39;ajaxpreso&#39;.&nbsp; The tables aren&#39;t very complicated - <em>if you run MS SQL, just look at the .sql file and you&#39;ll see how the tables are set up.&nbsp; You can set those up manually.</em> http://www.webtrenches.com/post.cfm/ajax-features-in-coldfusion-8 http://www.webtrenches.com/post.cfm/ajax-features-in-coldfusion-8 DefaultColdFusionWeb DevelopmentAjax Wed, 12 Dec 2007 15:15:09 GMT Connecting to Gmail using ColdFusion <p>Do you want to build an integrated ColdFusion interface to Gmail?&nbsp; Using newbish&#39;s <a href="http://sourceforge.net/projects/cfimap-cfc" target="_blank">IMAP CFC client</a>, it can be done.&nbsp; It just needs a couple modifications to work with Gmail&#39;s SLL IMAP. &nbsp;</p><p>Here&#39;s how...</p><p>1. <a href="http://mail.google.com/support/bin/answer.py?answer=77695" target="_blank">Enable IMAP</a> in your Gmail account <br />2. Download the <a href="http://sourceforge.net/projects/cfimap-cfc" target="_blank">IMAP CFC from SourceForge</a>.<br />3. Make the following modifications to the imap.cfc</p><ul><li>On line 7, add this... &lt;cfset this.sslenabled = 0 /&gt;</li><li>At the end of the init() function, add this...<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfif isdefined(&quot;arguments.ssl&quot;)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset this.sslenabled = 1 /&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/cfif&gt;</li><li>Replace the GetStore() function with this one...<br />&nbsp;&nbsp;&nbsp; &lt;cffunction name=&quot;GetStore&quot; access=&quot;private&quot; output=&quot;No&quot;&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cftry&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset clsSession = createObject(&quot;Java&quot;, &quot;javax.mail.Session&quot;)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objProperties = createObject(&quot;Java&quot;, &quot;java.util.Properties&quot;)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objStore = createObject(&quot;Java&quot;, &quot;javax.mail.Store&quot;)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset Timeout = this.imapTimeout * 1000&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfif this.sslenabled&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset protocol = &quot;imaps&quot;&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfelse&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset protocol = &quot;imap&quot;&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/cfif&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objProperties.init()&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objProperties.put(&quot;mail.store.protocol&quot;, protocol)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objProperties.put(&quot;mail.imap.port&quot;, this.imapPort)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objProperties.put(&quot;mail.imap.connectiontimeout&quot;, Timeout)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objProperties.put(&quot;mail.imap.timeout&quot;, Timeout)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objSession = clsSession.getInstance(objProperties)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objStore = objSession.getStore()&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfset objStore.connect(this.imapServer, this.username, this.password)&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfcatch type=&quot;any&quot;&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; You do not have a mail account or there was a problem authenticating.&lt;cfabort&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/cfcatch&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/cftry&gt;<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;cfreturn objStore&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/cffunction&gt;</li></ul><p><br />You can now use the CFC library to interface with Gmail&#39;s IMAP.&nbsp; Just make sure to pass the right arguments into the init function - The port has to be 993 for Gmail, and argument 6 should be a 1 (ssl enabled).&nbsp; The CFC will still work for non-SSL IMAP calls if you want to use it. Just pass a 0 in argument 6.<br /></p><p>Here&#39;s an example for Gmail...</p><p>&lt;!--- Written by Jason Quatrino, Hamilton College // ---&gt;<br />&lt;cfset imapCFC = CreateObject(&quot;component&quot;,&quot;imap&quot;) /&gt; <br />&lt;cfset imapInit = imapCFC.Init(username,password,&quot;imap.gmail.com&quot;,993,15,1) /&gt;&lt;!--- add your own username/password ---&gt;<br />&lt;!--- determine which message ids to get ---&gt;<br />&lt;cfset msgs = imapCFC.list(&quot;Inbox&quot;) /&gt;<br />&lt;!--- Return a query of messages ---&gt;<br />&lt;cfdump var=&quot;#msgs#&quot; /&gt;</p><p>If you have a TON of e-mail in your Gmail Inbox, you might want to modify this code before you run it.&nbsp; Something like this... pass in just a few message IDs in the second argument of the list function.&nbsp; I can share more code if people are interested, but I don&#39;t have permission from &quot;newbish&quot; to post the whole CFC. </p> http://www.webtrenches.com/post.cfm/connecting-to-gmail-using-coldfusion http://www.webtrenches.com/post.cfm/connecting-to-gmail-using-coldfusion DefaultColdFusionWeb Development Tue, 27 Nov 2007 13:34:40 GMT Upgrading to CF8 - Tips <p>I gave a presentation today at the <a href="http://www.cfugcny.org" target="_blank">Central New York CFUG</a> about upgrading to ColdFusion 8.&nbsp; I&#39;m afraid I may have scared some people away from updating, but that was not my intent!&nbsp; I simply wanted to prepare them for things they MIGHT run into.&nbsp; Most of the installs I have done have gone smoothly, and the problems are generally easy to figure out with a little research.&nbsp; The benefits of CF8 far outweigh running into a glitch or two during an upgrade. </p><p>I&#39;ve included the Powerpoint presentation download below, but here are some of the tips.</p><ul><li>Do a full clean install on another computer before attempting to upgrade a server.&nbsp; I&#39;ve run into situations where not all of the files will copy over in a new ColdFusion instance, and it is nice to be able to pull files from a clean install instead of reinstalling.<br /><br /></li><li>Prior to running an update, archive CF settings to a CAR file using the ColdFusion Archive feature in CF Administrator.&nbsp; You should back up everything except your JVM settings - CF8 uses a new JVM.&nbsp; Take note of your old settings for special class paths being used for CFX or Java, but do NOT try to apply them to CF8.&nbsp; <br /><br /> </li><li>If you are using Enterprise ...<br /></li><ul><li>stop all ColdFusion and IIS services including Verity (Search Service), ODBC, all instances, and IIS Admin Service.</li><li>make a copy of the JRUN4 folder</li><li>Uninstall ColdFusion 7</li><li>Delete the JRUN4 folder</li><li>Do a clean install<br /><br /></li></ul><li>If you are using Standard ...</li><ul class="contentlist"><li>The upgrade process is smooth</li><li>Back up your &#39;cfide&#39; folder because CF8 will change the contents</li><li>Take note of any custom tags, CFX, or other items that you had in the CFusionMX7 folder.&nbsp; The CF8 install will create a new folder called ColdFusion8.&nbsp; It will NOT delete the old folder.</li><li>Make sure you move any CFX, Custom Tags, Java Libraries, etc from CFusionMX7 to ColdFusion8 and update all references in the CF Administrator - including your JVM Settings.<br /><br /></li></ul></ul>Things you MIGHT run into...<br /><br /><ul><ul><li>When deploying instances in CF8, many times it will not copy all of the files needed.&nbsp; This is a common problem.&nbsp; Specifically, look for files in the {drive}\JRUN4\servers\{instancename}\cfusion.ear\ cfusion.war\WEB-INF\cfusion\db folder.</li><li>ODBC Services do not start.&nbsp; I&#39;ve seen this in two installs now.&nbsp; One of them I fixed by copying registry entries from a good install.&nbsp; If you aren&#39;t comfortable with registry edits, you may need to reinstall for this.&nbsp; Or... if you are using the built-in JDBC drivers, you don&#39;t need ODBC services anyhow.</li><li>If you aren&#39;t running one of the newer releases of BlogCFC, you&#39;ll need to either upgrade or make <a href="http://blogcfc.riaforge.org/index.cfm?event=page.issue&amp;issueid=24E957A4-D6A3-D31B-792511DEE3BDCAA5" target="_blank">this small change</a>.</li><li>Custom tags and CFX - Watch those paths in your CF configuration and jvm.config!&nbsp; Remember that they may point to CFusionMX7 (standard), or you may have to retrieve some files from your JRUN4 backup folder (Enterprise)</li><li>Custom IIS Application Folders - If you modified the mappings in IIS for a specific application or folder, they will not get upgraded when the CF installer updates your connectors.&nbsp; They will still map to the CF7 dll.&nbsp; You&#39;ll need to update those manually to match the mappings and wildcard DLL in the root folder of your site.&nbsp; <a href="mailto:mike@tspark.com">Drop me an an e-mail</a> if you want clarification on this.<br /><br /></li></ul></ul><p>Overall, the upgrade is DEFINITELY worth it.&nbsp; The speed increase alone is amazing, and the new CFIMAGE, CFFEED, and Ajax features are a huge boost to ColdFusion development.<br /><br /></p><ul><li><a href="/upgradingtocoldfusion8.zip">Download the Powerpoint presentation</a> </li></ul> http://www.webtrenches.com/post.cfm/upgrading-to-cf8-tips http://www.webtrenches.com/post.cfm/upgrading-to-cf8-tips DefaultColdFusionWeb ServersIIS Wed, 14 Nov 2007 00:24:44 GMT Gmail IMAP Attachment Errors <p>Several people who are using Gmail&#39;s fairly new IMAP feature have reported problems opening attachments through Thunderbird.&nbsp; Word and PDF documents, and possibly others, generate an error saying that they are &quot;unable to open&quot;.&nbsp; Apparently this has something to do with Gmail reporting an incorrect size for the attachment. &nbsp; The same attachments open fine when using the Gmail Web interface instead of Thunderbird.</p><p>&nbsp;Here is the fix for this ...</p><blockquote><ul><li>Tools &gt; Options... &gt; Advanced &gt; General &gt; Config Options </li><li> Search for &quot;chunk&quot; <br /></li><li> You should see a preference named &quot;mail.server.default.fetch_by_chunks&quot;. Toggle it to false. <br /></li><li>Close and restart.</li></ul></blockquote><br />I found this solution buried in <a href="http://groups.google.com/group/Gmail-POP-and-Forwarding/browse_thread/thread/afbb5dfec3b07e1a">Google Groups</a>.&nbsp; http://www.webtrenches.com/post.cfm/gmail-imap-attachment-errors http://www.webtrenches.com/post.cfm/gmail-imap-attachment-errors Default Sat, 10 Nov 2007 02:06:08 GMT Finally! Solid FTP in Eclipse <p>Aptana released the 1.0 version of their Eclipse Plug-in (now called <a href="http://www.aptana.com/download/" target="_blank">Aptana Studio for Eclipse</a>).&nbsp; I&#39;ve been <a href="/post.cfm/be-cool-or-be-productive-eclipse" target="_blank">rejecting Eclipse (CFEclipse) as a viable IDE</a> largely due to the show-stopping lack of ability to create a file on a remote FTP site.&nbsp; This release overcomes that severe limitation.&nbsp; You can now right-click on any folder in an FTP site, and select &#39;New File&#39;.&nbsp; This is an enormous productivity boost for developers who need to work on remote files.&nbsp; The previous methods of synchronizing entire projects was terrible.&nbsp; I&#39;ve got more evaluation to do before I can switch to CFECLIPSE, but this is a great sign.</p><p>&nbsp;<img src="/assets/content/Image/aptananewfile.gif" border="1" alt="Create new file with Aptana" title="Create new file with Aptana" />&nbsp;</p><p>It&#39;s time to give CFECLIPSE another shot...&nbsp;</p> http://www.webtrenches.com/post.cfm/finally-solid-ftp-in-eclipse http://www.webtrenches.com/post.cfm/finally-solid-ftp-in-eclipse DefaultColdFusionWeb Development Wed, 31 Oct 2007 15:09:30 GMT Great CF Training Resource <p><a href="http://www.webucator.com">Webucator</a> recently made much of their ColdFusion training library openly available to developers at <a href="http://www.coldfusionmanualonline.com/" target="_blank">http://www.coldfusionmanualonline.com/</a></p><p>If you&#39;ve never heard of Webucator, they are worth a look. &nbsp; They offer training, both online and in-person, for a wide variety of Web technologies.&nbsp; I took a DHTML session with them, and it was excellent.&nbsp;</p><p>PS - Thank you to <a href="http://www.petefreitag.com/item/655.cfm">Pete Freitag</a> for passing this along to our user group!&nbsp;</p><a href="http://www.coldfusionmanualonline.com/" target="_blank"></a> http://www.webtrenches.com/post.cfm/great-cf-training-resource http://www.webtrenches.com/post.cfm/great-cf-training-resource DefaultColdFusionWeb Development Fri, 19 Oct 2007 21:42:33 GMT Finally, IE Debugging for Ajax and Javascript <p>Since I started doing JavaScript and Ajax development I have always been frustrated with the lack of a good debugging tool for Internet Explorer.&nbsp; Firefox has Firebug, which is outstanding.</p><p>I think I may have finally found a solution - <a href="http://www.debugbar.com/" target="_blank">http://www.debugbar.com/</a></p><p>This can be a big help for those Ajax calls and JavaScript functions that work in Firefox but just don&#39;t seem to work right in IE.&nbsp;</p><p>Some of the features...</p><ul><li>See every Ajax request, the response headers, and the source code.<br /><img src="/assets/content/Image/debugbar.jpg" alt="" /><br /></li><li>View all the linked and inline scripts, html, and css in any loaded page.</li><li>An enhanced JavaScript console</li><li>HTML check - for validation</li></ul>There are also some nice extras in there, such as the color picker, window resizing to preset sizes, and the ability to e-mail screen shots when an error occurs. http://www.webtrenches.com/post.cfm/finallye-ie-debugging-for-ajax-and-javascript http://www.webtrenches.com/post.cfm/finallye-ie-debugging-for-ajax-and-javascript DefaultWeb DevelopmentAjax Thu, 18 Oct 2007 17:36:19 GMT Mean people and meaner people... <p>I&#39;ve been following the recent conversation about the <a href="http://blog.brianflove.com/articles/2007/09/13/cf-bloggers-search-stats" target="_blank">tip posted by a blogger</a> on how to &quot;trick&quot; the search stats on coldfusionbloggers.org.&nbsp; <a href="http://www.coldfusionjedi.com/index.cfm/2007/9/13/Mean-People-Suck" target="_blank">Many people are upset</a> about the fact that this was posted, but I think we should look at this another way.</p><p>I have personally spoken with the blogger who made the original post, and it was not intended to be a malicious act at all.&nbsp; He has great respect for Ray Camden, as do I.&nbsp; It was simply meant to educate people about potential security risks with Ajax. &nbsp; We&#39;re not talking about publicly showing people how to take down a site.&nbsp; It&#39;s just search statistics.</p><p>I&#39;ll agree that it was probably an error in judgement to put this out there, but it doesn&#39;t deserve the public flogging that is being delivered.&nbsp; Many of the comments posted on the Web Biz blog were so nasty that the author decided to take the blog down until this passes over.&nbsp;&nbsp; &quot;Mean people suck.&quot;&nbsp; Well, the people who are responding to this seem much more harsh than the original act was. </p><p>In reality, would&nbsp; you rather have someone on your development team who has the knowledge and skill to point out issues like this, or would you rather have someone who moves along blissfully unaware of major security flaws in their applications?&nbsp; <br /></p> http://www.webtrenches.com/post.cfm/mean-people-and-meaner-people http://www.webtrenches.com/post.cfm/mean-people-and-meaner-people DefaultColdFusionWeb Development Fri, 14 Sep 2007 21:33:42 GMT ColdFusion.getElementValue and $CF() <p>I first started doing Ajax programming using the <a href="http://www.prototypejs.org/" target="_blank">Prototype</a> framework.&nbsp; As I learn the new CF8 Ajax features, I find myself looking for simple ways to replicate some of the functionality that is in prototype.&nbsp; With prototype, you use $F(&#39;element&#39;) to return the value of a form field.&nbsp; There is a similar method for CF8, but it needs a little tweak...&nbsp;</p><p>The function that returns the value of a form element in ColdFusion 8&#39;s Ajax implementation is the following:</p><p>&nbsp;ColdFusion.getElementValue(id);</p><p>It&#39;s really handy because it will return a form field value for any type of form field - even select boxes and radio button.&nbsp;</p><p>However, that&#39;s a lot of typing if you are using many form values in your JavaScript/Ajax code.&nbsp; There is a super easy way to reduce this.&nbsp; Make your own shorter function that just calls this.</p><p>&nbsp;For example,</p><p>function $CF(element) {<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return ColdFusion.getElementValue(element);<br />&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p><p>&nbsp;Here is an oversimplified example:</p><p>&nbsp;&lt;cfajaximport /&gt;<br />&lt;cfform action=&quot;&quot; method=&quot;post&quot;&gt;<br />&lt;cfinput type=&quot;text&quot; name=&quot;testelement&quot; VALUE=&quot;test&quot; /&gt; <br />&lt;/cfform&gt;<br />&lt;script&gt;<br />&nbsp;&nbsp; &nbsp;function $CF(element) {<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return ColdFusion.getElementValue(element);<br />&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}<br />&nbsp;&nbsp; &nbsp;window.alert($CF(&#39;testelement&#39;));&nbsp;&nbsp; &nbsp;<br />&lt;/script&gt;</p><p>You could put the $CF function in a JS file that is used throughout your application.&nbsp; But remember, you can only use ColdFusion.getElementValue() on pages that invoke the Ajax libraries.&nbsp; In the example above, that&#39;s why I placed a &lt;cfajaximport /&gt; tag in there.&nbsp; This example doesn&#39;t use Ajax, and including the libraries is really a waste of resources in this circumstance.&nbsp; Save this trick for your true Ajax apps. &nbsp;</p><p><a href="http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_04.html" target="_blank">More about ColdFusion.getElemenValue() from Adobe</a> </p><p>&nbsp;</p> http://www.webtrenches.com/post.cfm/coldfusiongetelementvalue-and-cf http://www.webtrenches.com/post.cfm/coldfusiongetelementvalue-and-cf ColdFusionWeb DevelopmentAjax Thu, 13 Sep 2007 21:26:36 GMT Turn your CFC into a JavaScript Object (CF8 and Ajax) <p>One of my favorite new features of CF8 is the ability to create a JavaScript object from a CFC.&nbsp; You can then use the object to make Ajax calls.&nbsp; Here's a simple example that sends the results of checking an HTML check box into a CFC for processing...</p><p>&nbsp;<b>The CFM file:</b><br>&lt;cfajaxproxy cfc="mycfc" jsclassname="jsobj" /&gt;<br>&lt;script language="javascript"&gt;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; function checkmybox(cbox) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var ischecked = 1;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // create the object<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; var cfcAsAjax = new jsobj();<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (!cbox.checked) {ischecked=0;} <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Call the CFC function as a JavaScript function<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; cfcAsAjax.setChecked(cbox.value,ischecked); <br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&lt;/script&gt;<br>&nbsp;&lt;input type="checkbox" value="1234" name="cbox1" onclick="checkmybox(this);"&nbsp; /&gt; Add 1234 to my table.&lt;br/&gt;<br>&lt;input type="checkbox" value="5678" name="cbox2" onclick="checkmybox(this);"&nbsp; /&gt; Add 5678 to my table. <br></p><p><b>The CFC file (mycfc.cfc):</b><br>&nbsp;&lt;cfcomponent displayname="mycfc" hint="CFC for example Ajax app"&gt;<br>&nbsp;&nbsp;&nbsp; &lt;cffunction name="setChecked" access="remote"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfargument name="boxvalue" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfargument name="ischecked" /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfset var addrecord = '' /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfset var deleterecord = '' /&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfif arguments.ischecked&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfquery name="addrecord" datasource="#dsn#"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INSERT INTO mytable(boxvaluefield)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUES('#arguments.boxvalue#')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/cfquery&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfelse&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;cfquery name="deleterecord" datasource="#dsn#"&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DELETE FROM mytable<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHERE boxvaluefield = '#arguments.boxvalue#'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/cfquery&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/cfif&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/cffunction&gt;<br>&lt;/cfcomponent&gt;</p><p>It's not an incredibly useful example as far as functionality goes, but it demonstrates how easy it is to create a JavaScript object from a CFC and use it for Ajax calls.&nbsp; You could replace the check box event with any&nbsp; JavaScript-triggered event.&nbsp; This same functionality could be achieved using a CFINPUT and the "bind" attribute, but there are many cases where your form (or other object) is not a CF element (example, input instead of cfinput).&nbsp; <br></p> http://www.webtrenches.com/post.cfm/turn-your-cfc-into-a-javascript-object-cf8-and-ajax http://www.webtrenches.com/post.cfm/turn-your-cfc-into-a-javascript-object-cf8-and-ajax ColdFusionWeb DevelopmentAjax Wed, 05 Sep 2007 20:12:38 GMT ColdFusion 8 flies! <p>When Adobe released CF8, they touted the increased performance.&nbsp; I&#39;ve been using CF since 4.0, and I think this has been a claim for every release.&nbsp; I assumed it was just a marketing ploy, as I haven&#39;t noticed a huge difference in past upgrades.&nbsp; However, I am AMAZED at how much faster CF8 is than CF7.&nbsp; </p><p>We have a very programming-intensive portal that is heavily used by pretty much everyone at the college I work for.&nbsp; Its the access gateway to almost every Web system we have.&nbsp; Prior to CF8, the average page processing time for the portal was about 700ms. &nbsp; After CF8, it is down around 200ms.&nbsp; While a half-second might not seem like much, the impact is enormous.&nbsp; As a result, the rest of our site runs much faster.&nbsp; If you multiply that half-second by the thousands of logins we get in a day, you can see how much processing time is saved.</p><p>Our whole site is noticeably faster, even at peak traffic times.&nbsp; This boost alone makes the upgrade worth it.<br /> </p> http://www.webtrenches.com/post.cfm/coldfusion-8-flies http://www.webtrenches.com/post.cfm/coldfusion-8-flies DefaultColdFusion Fri, 24 Aug 2007 15:09:52 GMT Quick and easy column alignment for CFGRID <p>When using the CFGRID tag (type=&quot;html&quot;), there is no built-in way to align the data in the columns.&nbsp; The dataalign attribute of the CFGRIDCOLUMN tag is not available for the HTML grid type.&nbsp; There is a simple CSS trick to align the columns.</p><p>Each column in the grid has its own css class, and there is also a class that applies to all columns.&nbsp; The x-grid-col class allows you to apply formatting to all of the columns at once, for example: .x-grid-column {text-align:right;}.&nbsp; The rest of the columns have numbers associated with them, starting with 0 as the first column.&nbsp; So, the code below aligns all of the grid columns to the right, then sets only the first and second columns to align left. </p><p>&nbsp;&lt;style type=&quot;text/css&quot;&gt;<br />&nbsp;&nbsp; &nbsp;.x-grid-col {text-align:right;}<br />&nbsp;&nbsp; &nbsp;.x-grid-col-0 {text-align:left;}<br />&nbsp;&nbsp; &nbsp;.x-grid-col-1 {text-align:left;}<br />&lt;/style&gt;</p><p>&nbsp;You can also update just the column headers using a similar method.&nbsp; The&nbsp; headeralign attribute of cfgridcolumn also doesn&#39;t work for HTML grids.</p><p>&nbsp;&lt;style type=&quot;text/css&quot;&gt;<br />&nbsp;&nbsp; &nbsp;.x-grid-hd {text-align:center;}&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; .x-grid-hd-0-0 {text-align:left;}&nbsp;&nbsp; &nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; .x-grid-hd-0-1 {text-align:left;}<br />&lt;/style&gt;</p> http://www.webtrenches.com/post.cfm/quick-and-easy-column-alignment-for-cfgrid http://www.webtrenches.com/post.cfm/quick-and-easy-column-alignment-for-cfgrid ColdFusionWeb DevelopmentAjax Thu, 23 Aug 2007 15:12:00 GMT