<!--- This example shows how to use the StructClear
      function. It calls the CF_ADDEMPLOYEE custom tag,
      which uses the addemployee.cfm file. --->
<html>
<head>
<title>StructClear Function</title>
</head>
<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">
<h1>StructClear Function</h1>
<h3>Add New Employees</h3>
<P>
This example uses the StructClear 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  --->
<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>

<hr>
<FORM action="structclear.cfm" method="post">
<P>First Name:&nbsp;
<INPUT name="firstname" type="text" hspace="30" maxlength="30">
</p>
<P>Last Name:&nbsp;
<INPUT name="lastname" type="text" hspace="30" maxlength="30">
</p>
<P>EMail:&nbsp;
<INPUT name="email" type="text" hspace="30" maxlength="30">
</p>
<P>Phone:&nbsp;
<INPUT name="phone" type="text" hspace="20" maxlength="20">
</p>
<P>Department:&nbsp;
<INPUT name="department" type="text" hspace="30" maxlength="30">
</p>

<P>
<input type="submit" value="OK">
</p>
</FORM>

</body>
</html>
