Passing Values To And From Custom Tags - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

176

Passing values to and from custom tags

Because custom tags are individual ColdFusion pages, variables and other data are
not automatically shared between a custom tag and the calling page.
To pass data from the calling page to the custom tag, specify attribute name-value
pairs in the custom tag, just as you do for normal HTML and CFML tags. In the
custom tag you use the Attributes scope to access these variables.For example, to
pass the value of the NameYouEntered variable to the cf_getMD tag, you can call the
custom tag as follows:
<cf_getMD Name="#NameYouEntered#">
In the getmd.cfm file, you refer to the passed attribute as
To pass values back to the calling page, use the Caller scope. The custom tag page
can also access variables already set on the calling by simply prefixing the calling
page's local variable name with Caller. For example, use the following code to set the
variable Doctor on the calling page:
<cfset Caller.Doctor="Doctor " & Attributes.Name>
The following figure shows the relation between the variables on the calling page and
the custom tag:
Chapter 10 Reusing Code
.
Attributes.Name

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 5

Table of Contents