Web Trenches

As a defense against cross-site ccripting attacks (XSS), modern browsers now disallow ajax calls made across domains by default.  You can enable certain sites to make ajax calls to your site by adding the Access-Control-Allow-Origin header to the page.   For example, if your page at http://www.mydomain.com/main-page needs to make an ajax call to http://www.otherdomain.com/ajax-page, you would add […]

Story done by Hamilton College on our latest mobile Web project using both jQuery Mobile and CSS media queries: http://www.hamilton.edu/news/story/hamilton-offers-fast-access-with-new-mobile-friendly-app

I recently completed the beta version of CFjqAjax.  This is a library of custom tags that replicate the CFGRID, CFWINDOW, and CFTOOLTIP tags from ColdFusion 8.  The CF8 tags work, but I find YUI and Ext much harder to work with than jQuery, and the file size of the JavaScript libraries that CF8 includes is excessive.  So, […]

One of my colleagues recently mentioned to me that he was frustrated with CFGRID because after a grid row is selected, you can't trigger an action when it is clicked again.  Here's the solution I found.  First the grid code… <cfajaxproxy bind="javascript:todetail({shipments.id})" /><cfgrid query="sdQry" name="shipments" format="html" autowidth="false" selectonload="false" style="clear:both;"> <cfgridcolumn name="id" display="no" /><cfgridcolumn name="INVOSHIPDATEDISPLAY" header="Pickup Date" width="75" […]

The more I use the CF8 Ajax features, the more I like them.  CFTOOLTIP is a fairly simple tag, but you can do some fairly powerful things with it.   TIP #1 – Styling You can style a cftooltip to look like a pop-up window or Netflix-style pop-up.  Here's a small clip to put in your page […]

I gave a presentation titled "Introductionto Ajax Features in ColdFusion 8" at the Syracuse ColdFusion User Group meeting this week.   In the presentation, I covered the following. The basic layout elements that are used with Ajax Automatic Ajax – Things that ColdFusion 8 handles for you – without needing to program any JavaScript. Almost-Automatic Ajax – Things […]

Since I started doing JavaScript and Ajax development I have always been frustrated with the lack of a good debugging tool for Internet Explorer.  Firefox has Firebug, which is outstanding. I think I may have finally found a solution – http://www.debugbar.com/ This can be a big help for those Ajax calls and JavaScript functions that work in […]

I first started doing Ajax programming using the Prototype framework.  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.  With prototype, you use $F('element') to return the value of a form field.  There is a similar method for CF8, but it […]

One of my favorite new features of CF8 is the ability to create a JavaScript object from a CFC.  You can then use the object to make Ajax calls.  Here's a simple example that sends the results of checking an HTML check box into a CFC for processing…  The CFM file:<cfajaxproxy cfc=”mycfc” jsclassname=”jsobj” /><script language=”javascript”>        function […]

When using the CFGRID tag (type="html"), there is no built-in way to align the data in the columns.  The dataalign attribute of the CFGRIDCOLUMN tag is not available for the HTML grid type.  There is a simple CSS trick to align the columns. Each column in the grid has its own css class, and there is also […]