MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 231

Developing coldfusion mx applications
Table of Contents

Advertisement

Note: To use URL invocation, you must set the
To pass parameters to component methods using a URL, append the parameters to the URL in
standard URL query-string, name-value pair syntax; for example:
http://localhost:8500/corpQuery.cfc?method=getEmp&lastName=camden
To pass multiple parameters within a URL, use the ampersand (&) character to delimit the name-
value pairs. For example:
http://localhost:8500/
corpQuerySecure.cfc?method=getAuth&store=women&dept=shoes
Note: To ensure data security, Macromedia strongly recommends that you not pass sensitive
information over the web using URL strings. Potentially sensitive information includes all personal
user information, including passwords, addresses, telephone numbers, and so on.
If a CFC method that you access using the URL displays output directly, the user's browser shows
the output. (You can use the
the CFC returns a result using the
format (with special characters replaced by their HTML escape sequences), puts it in a WDDX
packet, and includes the packet in the HTML that it returns to the client.
Invoking component methods using a form
To invoke a method using a ColdFusion or HTML form, the following must be true:
The
or
form
cfform
The form must have an input tag (it can be a hidden input tag) with the name method and the
method name as its value.
The form must have an input tag for each component method parameter. The
of the tag must be the method parameter name and the field value is the parameter value.
The
tag that defines the CFC method being invoked must specify the
cffunction
access="remote"
If the CFC method that you invoke from the form displays output directly, the user's browser
shows the output. (You can use the
output.) If the CFC returns a result using the
HTML edit format, puts it in a WDDX packet, and includes the packet in the HTML that it
returns to the client.
To invoke component methods using a form:
Create a corpFind.cfm file with the following contents:
1
<h2>Find People</h2>
<form action="components/corpQuery.cfc" method="post">
<p>Enter employee's last Name:</p>
<input type="Text" name="lastName">
<input type="Hidden" name="method" value="getEmp">
<input type="Submit" title="Submit Query"><br>
</form>
In the example, the
tags invoke the component method.
input
tag
cffunction
cfreturn
tag
attribute must specify the CFC filename or path.
action
attribute.
cffunction
tag's
attribute points to the
form
action
cffunction
tag's access attribute to remote.
attribute to disable displaying output.) If
output
tag, ColdFusion converts the text to HTML edit
tag
attribute to disable displaying
output
tag, ColdFusion converts the text to
cfreturn
corpQuery
Using ColdFusion components
attribute
name
component. The
231

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents