home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / structclear.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.9 KB  |  66 lines

  1. <!--- This example shows how to use the StructClear
  2.       function. It calls the CF_ADDEMPLOYEE custom tag,
  3.       which uses the addemployee.cfm file. --->
  4. <html>
  5. <head>
  6. <title>StructClear Function</title>
  7. </head>
  8. <body>
  9. <h1>StructClear Function</h1>
  10. <h3>Add New Employees</h3>
  11. <P>
  12. This example uses the StructClear function. To run this snippet
  13. under UNIX, you must add employee ID generation logic 
  14. to the addemployee.cfm file.
  15. <!--- Establish parms for first time through  --->
  16. <CFPARAM name="FORM.firstname" default="">
  17. <CFPARAM name="FORM.lastname" default="">
  18. <CFPARAM name="FORM.email" default="">
  19. <CFPARAM name="FORM.phone" default="">
  20. <CFPARAM name="FORM.department" default=""> 
  21.  
  22. <CFIF #FORM.firstname# EQ "">
  23.  <P>Please fill out the form.
  24. <CFELSE>
  25.   <CFOUTPUT>
  26.    <CFSCRIPT>
  27.      employee=StructNew();
  28.      StructInsert(employee, "firstname", "#FORM.firstname#");
  29.      StructInsert(employee, "lastname", "#FORM.lastname#");
  30.      StructInsert(employee, "email", "#FORM.email#");
  31.      StructInsert(employee, "phone", "#FORM.phone#");
  32.      StructInsert(employee, "department", "#FORM.department#"); 
  33.    </CFSCRIPT> 
  34.   </cfoutput>
  35.  
  36.   <!--- Call the custom tag that adds employees --->
  37.   <CF_ADDEMPLOYEE EMPINFO="#employee#">
  38.   <CFSCRIPT>StructClear(employee);</CFSCRIPT>  
  39.  </cfif>
  40.  
  41. <hr>
  42. <FORM action="structclear.cfm" method="post">
  43. <P>First Name: 
  44. <INPUT name="firstname" type="text" hspace="30" maxlength="30">
  45. </p>
  46. <P>Last Name: 
  47. <INPUT name="lastname" type="text" hspace="30" maxlength="30">
  48. </p>
  49. <P>EMail: 
  50. <INPUT name="email" type="text" hspace="30" maxlength="30">
  51. </p>
  52. <P>Phone: 
  53. <INPUT name="phone" type="text" hspace="20" maxlength="20">
  54. </p>
  55. <P>Department: 
  56. <INPUT name="department" type="text" hspace="30" maxlength="30">
  57. </p>
  58.  
  59. <P>
  60. <input type="submit" value="OK">
  61. </p>
  62. </FORM>
  63.  
  64. </body>
  65. </html>
  66.