<CFASSOCIATE> Tag - ColdFusion


>> Return to CF Tag List

The <CFASSOCIATE> tag allows you to associate subtags, or child tags, with base tags. This tag can only be used within custom tag template files. It is used within the subtag to make the subtag data available to the base tag. The subtag data is stored in a structure in the base tag.

Syntax:
  <CFASSOCIATE
                    BASETAG="Base Tag Name"
                    [DATACOLLECTION="Collection Name"]>

Attributes:
ATTRIBUTE   DESCRIPTION   COMMENTS
BASETAG   The Base Tag's Name   Required. Contains the name of the base tag associated with this subtag.
DATACOLLECTION   Structure's name in the base tag to store attributes   Optional. Defaults to structure of AssocAttrib is used.


  <CFASSOCIATE> Comments from Macromedia LiveDocsLiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-pa5.htm
In my last comment I forgot to mention that
while I'm not sure why cfapplication, cferror and
cflock are listed as related tags, the functions
getbasetagpath() and getbasetagdata() really
ought to be included in the "see also" for this tag

LiveDocs Comments - coldfusion - 6.1 - htmldocs - tags-pa5.htm
Unfortunately documentation for this tag is somewhat lacking...
Probably owing to its infrequent use...

That being said these are my pointers:
1) the basetag attribute should always be formatted as "cf_mytag" which will work the same even when using cfmodule or cfimport syntax
2) if the CFMX engine doesn't find the base tag it will produce the error message "base tag did not expose any data" (which confused me because I expected "base tag not found" or something similar)
3) to clarify: to access data from the sub-tag within the base tag using thistag.collectionName remember this variable will always be an array of structures, so that if there are multiples of the same sub-tag
the array will contain multiple structures - thus if the sub-tag cf_input contains only <cfassociate basetag="cf_form" dataCollection="input">
the syntax to get the name attribute of the first cf_input tag within cf_form is #thistag.input[1].name#



[Top]


Recommended Books

[Top]

Web Sites

[Top]

Copyright © 2003- 2008, Orville Paul Chomer, All Rights Reserved