Ajax (Asynchronous JavaScript and XML) is a set of web technologies for creating interactive web applications. Ajax applications typically combine:

  • HTML and CSS for formatting and displaying information.
  • JavaScript for client-side dynamic scripting
  • Asynchronous communication with a server using the XMLHttpRequest function.
  • XML or JSON (JavaScript Object Notation) as a technique for serializing and transferring data between the sever and the client.
    ColdFusion provides many tools that simplify using Ajax technologies for dynamic applications. By using ColdFusion tags and functions, you can easily create complex Ajax applications.

ColdFusion Ajax features

ColdFusion provides two types of Ajax features:

  • Data and development features
  • User interface features
Data and development features

ColdFusion data and development features help you develop effective Ajax applications that use ColdFusion to provide dynamic data. They include many features that you can use with other Ajax frameworks, including Spry. 
The following data and development features are important for use with form and layout tags:

  • ColdFusion supports data binding in many tags. Binding allows form and display tags to dynamically display information based on form input. In the simplest application, you display form data directly in other form fields. But usually, you pass form field data as parameters to CFC or JavaScript functions or CFM pages, and use the results to control the display.
  • The cfajaximport tag specifies the location of the JavaScript and CSS files that a ColdFusion page imports or to selectively import files required by specific tags. The ability to change the file location lets you support a wide range of configurations and use advanced techniques, such as application-specific styles.
    For more information about the data and development features and how to use them, see Using Ajax Data and Development Features.
User Interface tags and features

Several ColdFusion user interface elements incorporate Ajax features. The tags and tag-attribute combinations can be divided into the following categories:

  • Container tags that lay out or display contents
  • File management tags that handle files
  • Form tags that dynamically display data
  • A menu tag that lets you create menu bars and pull-down menus
  • User assistance features that provide tool tips and form completion
  • Four other tags for using geographical maps, progress bar, media player, and message box.
    The following table lists the basic tags and attributes that display the Ajax-based features. For information on additional forms-specific features, see Using Ajax form controls and features.

Tag/attribute

Description

Container tags

cfdiv

An HTML div region that can be dynamically populated by a bind expression. Forms in this region submit asynchronously.

cflayout

A horizontal or vertical box, a tabbed region, or a set of bordered regions that can include a top, bottom, left, right, and center regions.

cflayoutarea

An individual region within a cflayout area, such as the display that appears in a tabbed layout when the user select a tab. Forms in this region submit asynchronously.

cfpod

An area of the browser window with an optional title bar and a body that contains display elements. Forms in this region submit asynchronously.

cfwindow

A pop-up window within the browser. You can also use the ColdFusion.Window.createWindow function to create a pop-up window. Forms in this region submit asynchronously.

File management tags

cffileupload

A dialog for uploading multiple files from the user's system.

Forms tags

cfgrid format="html"

A dynamic, editable, sortable, data grid.

cfinput type="datefield"

An input control that users can fill by selecting a date from a pop-up calendar.

cftextarea richtext="yes"

A text area with a set of controls that let users format the displayed text.

cftree format="html"

A dynamic tree-format representation of data.

cfslider

A slider control, for selecting a numeric value from a range, in a ColdFusion form.

Menu tags

cfmenu

A menu bar or the root of a drop-down menu.

cfmenuitem

An individual item in a menu, or the root of a submenu.

User assistance tags and attributes

cfinput type="text" autosuggest="bind}}{{expression"

A drop-down autofill suggestion box. As the user types, a list appears with completion suggestions based on the text the user has typed.

cftooltip tag, and the tooltip attribute on cfinput, cfselect, cftextarea controls

A textual description of a control or region that appears when the user hovers the mouse over the control or region.

Other tags

cfprogressbar

A progress bar to indicate the progress of an activity such as a file download.

cfmap

A geographical map within a ColdFusion web page.

cfmediaplayer

An inbuild media player.

cfmessagebox

A control for displaying pop-up messages.

In addition to the tags and attributes, ColdFusion provides many JavaScript functions that let you control and manage the display. Many functions control the display of specific tags. For example, you can use JavaScript functions to dynamically display and hide the window. There are also several utility tags, such as the ColdFusion.getElementValue function that gets the value of a control attribute, or the ColdFusion.navigate function that displays the results of a URL in a container tag. For a complete list of all ColdFusion Ajax JavaScript functions, and detailed function descriptions, see Ajax JavaScript Functions in the CFML Reference.

Using ColdFusion Ajax user interface features

ColdFusion Ajax user interface features let you create data-driven pages that update dynamically without requiring multiple HTML pages or page refreshes or non-HTML display tools such as Flash forms. Many user interface features use data binding to dynamically get data based on other data values: form field values, form control selections, and selections in Spry data sets.
ColdFusion Ajax user interface controls and features can be divided into two major categories:

  • Display layout
  • Data interaction
    Display layout controls include the cflayout, cfpod, and cfwindow controls. Some of the data interaction features include the HTML cfgrid control, the cfmenu control, and dynamic autosuggest lists for text input controls. Most display layout and data interaction features can use data binding to dynamically interact with the user.
    ColdFusion Ajax user interface features are based on the [Yahoo
    User Interface Library|http://developer.yahoo.com/yui/] and the Ext JavaScript Library. Also, the cftextarea rich text editor is based on the FCKeditor text editor. In most situations, you require only ColdFusion tags and functions (including JavaScript functions) to create and manage the interface. However, advanced developers can modify the library code, particularly the CSS styles, to customize the controls in more complex ways.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy