CFASSOCIATE | |
Description
Allows subtag data to be saved with a base tag. Applies only to custom tags. |
|
Category
Application framework tags | |
Syntax<cfassociate baseTag = "base_tag_name" dataCollection = "collection_name"> | |
See also
cfapplication, cferror, cflock, cfmodule
|
|
Usage
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. |
|
Example <!--- 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"> ... |
BASETAG | |
Required | |
Base tag name |
DATACOLLECTION | |
Optional | |
Default value: "AssocAttribs"
Structure in which base tag stores subtag data |