Allows subtag data to be saved with a base tag. Applies only to custom tags.
<cfassociate baseTag = "base_tag_name" dataCollection = "collection_name">
cfapplication,
cferror,
cflock,
cfmodule
Attribute | Req/Opt | Default | Description |
---|---|---|---|
baseTag |
Required |
|
Base tag name |
dataCollection |
Optional |
AssocAttribs |
Structure in which base tag stores subtag data |
Call this tag within a subtag, to save subtag data in the base tag.
When ColdFusion passes subtag attributes back to the base tag, it saves them in a structure whose default name is AssocAttribs
. To segregate subtag attributes (in a base tag that can have multiple subtags), specify a structure name, in the DataCollection
attribute. The structure is appended to an array whose name is thistag.collectionName.
Within the custom tag code, the attributes passed with the attributeCollection
attribute are saved as independent values, with no indication that they are grouped into a structure by the custom tag's caller.
If an attribute value is explicitly assigned to the attribute name, and is a member of the attributecollection
attribute, the explicit value overrides the value in the attributecollection
structure.
<!--- Find the context ---> <cfif thisTag.executionMode is "start"> <!--- Associate attributes ---> <cfassociate baseTag = "CF_TAGBASE"> <!--- Define defaults for attributes ---> <cfparam name = "attributes.happy" default = "Yes"> <cfparam name = "attributes.sad" default = "No"> ...