|
ColdFusion 9.0 Resources |
StructClearSee alsoStructure functions; Modifying a ColdFusion XML object in the Developing ColdFusion Applications UsageDo not call this function on a session variable. For more information, see TechNote, “ ColdFusion 4.5 and the StructClear(Session) function,” at go.adobe.com/kb/ts_tn_17479_en-us. (The article applies to ColdFusion 4.5, 5.x, and ColdFusion MX.) Example<!--- Shows StructClear function. Calls cf_addemployee custom tag which
uses the addemployee.cfm file. --->
<body>
<h1>Add New Employees</h1>
<!--- Establish params for first time through --->
<cfparam name = "Form.firstname" default = "">
<cfparam name = "Form.lastname" default = "">
<cfparam name = "Form.email" default = "">
<cfparam name = "Form.phone" default = "">
<cfparam name = "Form.department" default = "">
<cfif form.firstname eq "">
<p>Please fill out the form.
<cfelse>
<cfoutput>
<cfscript>
employee = StructNew();
StructInsert(employee, "firstname", Form.firstname);
StructInsert(employee, "lastname", Form.lastname);
StructInsert(employee, "email", Form.email);
StructInsert(employee, "phone", Form.phone);
StructInsert(employee, "department", Form.department);
</cfscript>
</cfoutput>
<!--- Call the custom tag that adds employees --->
<cf_addemployee empinfo = "#employee#">
<cfscript>StructClear(employee);</cfscript>
</cfif>
|