home *** CD-ROM | disk | FTP | other *** search
- <!--- This view-only example illustrates usage
- of StructKeyExists. --->
- <P>This file is similar to addemployee.cfm, which is called
- by StructNew, StructClear, and StructDelete. To test this file,
- copy the <cfelseif> statement to the appropriate place
- in addemployee.cfm. It is an example of a custom tag used
- to add employees. Employee information is passed through the
- employee structure (the EMPINFO attribute).
- <P>
- To run this snippet
- under UNIX, you must add employee ID generation logic.
- <!---
- <cfswitch expression="#ThisTag.ExecutionMode#">
- <cfcase value="start">
- <CFIF StructIsEmpty(attributes.EMPINFO)>
- <CFOUTPUT>Error. No employee data was passed.</cfoutput>
- <CFEXIT METHOD="ExitTag">
- <cfelseif NOT StructKeyExists(attributes.EMPINFO, "department")>
- <cfscript>StructUpdate(attributes.EMPINFO, "department", "Unassigned")</cfscript>
- <CFEXIT METHOD="ExitTag">
- <cfelse>
- <CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
- INSERT INTO Employees(FirstName, LastName, Email, Phone, Department)
- VALUES
- <CFOUTPUT>
- (
- '#StructFind(attributes.EMPINFO, "firstname")#' ,
- '#StructFind(attributes.EMPINFO, "lastname")#' ,
- '#StructFind(attributes.EMPINFO, "email")#' ,
- '#StructFind(attributes.EMPINFO, "phone")#' ,
- '#StructFind(attributes.EMPINFO, "department")#'
- )
- </cfoutput>
- </cfquery>
- </cfif>
- <CFOUTPUT><HR>Employee Add Complete
- </cfcase>
- </cfswitch> --->
-
-