View comments | RSS feed

DeleteClientVariable

Description

Deletes a client variable. (To test for the existence of a variable, use IsDefined.)

Returns

True, if the variable is successfully deleted; false, otherwise.

Category

Other functions

Function syntax

DeleteClientVariable("name")

See also

GetClientVariablesList

History

ColdFusion MX: Changed behavior: if the variable is not present, this function now returns False. (In earlier releases, it threw an error.)

Parameters

Parameter Description

name

Name of a client variable to delete, surrounded by double-quotation marks

Example

<!--- This view-only example shows DeleteClientVariable --->
<h3>DeleteClientVariable Example</h3>

<p>This view-only example deletes a client variable called "User_ID", if it 
   exists in the list of client variables returned by GetClientVariablesList.
<p>This example requires the existence of an Application.cfm file and client
   management to be in effect.
<!--- 
<cfset client.somevar = "">
<cfset client.user_id = "">
<p>Client variable list:<cfoutput>#GetClientVariablesList()#</cfoutput>
<cfif ListFindNoCase(GetClientVariablesList(), "User_ID") is not 0>

      <cfset temp = DeleteClientVariable("User_ID")>
      <p>Was variable "User_ID" Deleted? <cfoutput>#temp#</cfoutput>
</cfif>
<p>Amended Client variable list:<cfoutput>#GetClientVariablesList()#
</cfoutput>
--->

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting

Version 7

Comments


Richard Davies said on Jul 24, 2007 at 9:43 AM :
DeleteClientVariable() doesn't work for client variables whose name contain a period. (i.e. Client.test.one)

You must use StructDelete() to delete these variables.
halL said on Jul 25, 2007 at 6:42 AM :
The behavior mentioned by Richard Davies is by design.
Periods are not considered valid characters in client variable names, although ColdFusion does not prevent you from using them.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00000453.htm