Adobe COLDFUSION 9 Manual page 218

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Building Blocks of ColdFusion Applications
Using tag attributes summary
Custom tag attribute values are passed from the calling page to the custom tag page as name-value pairs. CFML custom
tags support required and optional attributes. Custom tag attributes conform to the following CFML coding standards:
• ColdFusion passes any attributes in the Attributes scope.
• Use the
Attributes.attribute_name
tag page local variables.
• Attributes are not case sensitive.
• Attributes can be listed in any order within a tag.
• in the tag invocation, a space must separate attribute name-value pairs.
• Passed values that contain spaces must be enclosed in double-quotation marks.
• Use the
tag with a
cfparam
attributes that are passed from a calling page. For example:
<!--- The value of the variable Attributes.Name comes from the calling page. If
the calling page does not set it, make it "Who". --->
<cfparam name="Attributes.Name" default="Who">
• Use the
tag or a
cfparam
attributes that must be passed from a calling page; for example, the following code issues an abort if the user does
not specify the Name attribute to the custom tag:
<cfif not IsDefined("Attributes.Name")>
<cfabort showError="The Name attribute is required.">
</cfif>
Custom tag example with attributes
The following example creates a custom tag that uses an attribute that is passed to it to set the value of a variable called
Doctor on the calling page.
1
Create a ColdFusion page (the calling page) with the following content:
syntax when referring to passed attributes to distinguish them from custom
attribute at the top of a custom tag to test for and assign defaults for optional
default
tag with an
cfif
IsDefined
Last updated 8/5/2010
function at the top of a custom tag to test for required
213

Advertisement

Table of Contents
loading

Table of Contents