home *** CD-ROM | disk | FTP | other *** search
- <!--- This example shows how to use the StructDelete
- function. It calls the CF_ADDEMPLOYEE custom tag,
- which uses the addemployee.cfm file. --->
- <html>
- <head>
- <title>StructDelete Function</title>
- </head>
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
- <h3>StructDelete Function</h3>
- <h3>Add New Employees</h3>
- <P>
- This example uses the StructDelete function. To run this snippet
- under UNIX, you must add employee ID generation logic
- to the addemployee.cfm file.
- <!--- Establish parms for first time through --->
- <!--- 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>