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

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