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:
Attributes.
attribute_name
syntax when referring to passed attributes to distinguish them from custom tag page local variables.
cfparam
tag with a default
attribute at the top of a custom tag to test for and assign defaults for optional 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">
cfparam
tag or a cfif
tag with an IsDefined
function at the top of a custom tag to test for required 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>