Removes an item from a structure.
StructDelete(structure, key [, indicatenotexisting ])
StructClear, StructFind, StructInsert, StructIsEmpty, StructKeyArray, StructKeyExists, StructKeyList, StructCount, StructNew, StructUpdate, StructAppend, StructGet, StructSort, StructFindKey, StructClear
<!--- This example shows how to use the StructDelete function. --->
<html>
<head>
<title>StructDelete Function</title>
</head>
<basefont face = "Arial, Helvetica" size = 2>
<body bgcolor = "#FFFFD5">
<H3>StructDelete Function</H3>
<P>
This example uses the StructInsert and StructDelete functions.
<!--- Establish parms for first time through --->
<CFPARAM name = "firstname" DEFAULT = "Mary">
<CFPARAM name = "lastname" DEFAULT = "Torvath">
<CFPARAM name = "email" DEFAULT = "mtorvath@allaire.com">
<CFPARAM name = "phone" DEFAULT = "777-777-7777">
<CFPARAM name = "department" DEFAULT = "Documentation">
<cfif IsDefined("FORM.Delete")>
<cfoutput>
Field to be deleted: #form.field#
</cfoutput>
<P>
<CFScript>
employee = StructNew();
StructInsert(employee, "firstname", firstname);
StructInsert(employee, "lastname", lastname);
StructInsert(employee, "email", email);
StructInsert(employee, "phone", phone);
StructInsert(employee, "department", department);
</CFScript>
<cfoutput>
employee is a structure: #IsStruct(employee)#
</cfoutput>
<cfset rc = StructDelete(employee, "#form.field#", "True")>
<cfoutput>
<P>Did I delete the field "#form.field#"? The code indicates: #rc#
</P>
</cfoutput>
</cfif>
<cfif NOT IsDefined("FORM.Delete")>
<form action = "structdelete.cfm" method = "post">
<P>Select the field to be deleted:
<select name = "field">
<option value = "firstname">first name
<option value = "lastname">last name
<option value = "email">email
<option value = "phone">phone
<option value = "department">department
</select>
<input type = "submit" name = "Delete" value = "Delete">
</FORM>
</cfif>
</body>
</html>