Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
16
CFML Language Reference 
CFASSOCIATE
The CFASSOCIATE tag allows sub-tag data to be saved with the base tag. This applies to 
custom tags only.
Syntax
<CFASSOCIATE BASETAG="tagname"
DATACOLLECTION="collectionname">
BASETAG
Specifies the name of the base tag.
DATACOLLECTION
Optional. Specifies the name of the structure in which the base tag stores sub-tag 
data. The default is AssocAttribs.
Usage
Call this tag within a sub-tag to save sub-tag data in the base tag.
ColdFusion saves sub-tag attributes in a structure whose default name is AssocAttribs. 
Use the DataCollection attribute to specify a non-default structure name. Specify a 
non-default structure name when the base tag can have multiple sub tags and you 
want to segregate sub-tag attributes.
If the custom tag uses an attribute collection, the attributes passed in the attribute 
collection are saved as independent attribute values, with no indication that they were 
grouped together in a structure within the custom tag.
Example
<!--- Find the context --->
<CFIF thisTag.executionMode is "start">
  <!--- Associate attributes 
      This code occurs in a custom tag’s 
      sub tag. --->
  <CFASSOCIATE BASETAG="CF_TAGBASE">
  <!--- Define defaults for attributes --->
  <CFPARAM NAME="attributes.happy" DEFAULT="Yes">
  <CFPARAM NAME="attributes.sad" DEFAULT="No">
...