Whatever message this page gives is out now! Go check it out!
<!--- The following code creates a simple form for entering a user name and password.
The code does not include password verification. --->
<h3>Timesheet Login Form</h3>
<p>Please enter your user name and password.</p>
<cfform name="loginform" action="loginform_proc.cfm" method="post">
<table>
<tr>
<td>user name:</td>
<td><cfinput type="text" name="username" required="yes"
message="A user name is required."></td>
</tr>
<tr>
<td>password:</td>
<td><cfinput type="password" name="password" required="yes"
message="A password is required."></td>
</tr>
</table>
<br/>
<cfinput type="submit" name="submit" value="Submit">
</cfform><!--- The following code retrieves all of the employee information for the user name entered
on the login page. --->
<cfquery name="getEmpInfo" datasource="cfdocexamples">
SELECT * FROM EMPLOYEES
WHERE EMAIL = <cfqueryparam value="#FORM.username#">
</cfquery>
<!---
The following code populates the template called "timesheetForm.pdf" with data from the query and displays the interactive PDF form in the browser. A field in the PDF form contains the name of the output file being written. It is a combination of the user name and the current date.
--->
<!--- Notice the use of the cfpdfsubform tag. Forms created from templates in LiveCycle Designer include a subform called form1. Use the cfpdfsubform tag to match the structure of the form in ColdFusion. Likewise, the field names in the cfpdfformparam tags must match the field names in the PDF form. If the form structures and field names do not match exactly, ColdFusion does not populate the form fields. --->
<cfpdfform source="c:\forms\timesheetForm.pdf" action="populate">
<cfpdfsubform name="form1">
<cfpdfformparam name="txtEmpName" value="#getEmpInfo.FIRSTNAME#
#getEmpInfo.LASTNAME#">
<cfpdfformparam name="txtDeptName" value="#getEmpInfo.DEPARTMENT#">
<cfpdfformparam name="txtEmail" value="#getEmpInfo.IM_ID#">
<cfpdfformparam name="txtPhoneNum" value="#getEmpInfo.PHONE#">
<cfpdfformparam name="txtManagerName" value="Randy Nielsen">
<cfpdfformparam name="txtSheet"
value="#form.username#_#DateFormat(Now())#">
</cfpdfsubform>
</cfpdfform><!--- The following code reads the PDF file submitted in binary format and generates a result structure called fields. The cfpdfform populate action and the cfoutput tags reference the fields in the structure. --->
<cfpdfform source="#PDF.content#" action="read" result="fields"/>
<cfset empForm="#fields.form1#">
<cfpdfform action="populate" source="#PDF.content#" destination="timesheets\#empForm.txtsheet#.pdf" overwrite="yes"/>
<h3>Timesheet Completed</h3>
<p><cfoutput>#empForm.txtempname#</cfoutput>,</p>
<p>Thank you for submitting your timesheet for the week of <cfoutput>#DateFormat(empForm.dtmForPeriodFrom, "long")#</cfoutput> through <cfoutput>#DateFormat(empForm.dtmForPeriodto, "long")#</cfoutput>. Your manager, <cfoutput>#empForm.txtManagerName#</cfoutput>, will notify you upon approval.</p><!--- The following code creates a simple form for entering a user name and password. The code does not include password verification. --->
<h3>Employee Update Login Form</h3>
<p>Please enter your user name and password.</p>
<cfform name="loginform" action="loginform_procHTTP.cfm" method="post">
<table>
<tr>
<td>user name:</td>
<td><cfinput type="text" name="username" required="yes"
message="A user name is required."></td>
</tr>
<tr>
<td>password:</td>
<td><cfinput type="password" name="password" required="yes"
message="A password is required."></td>
</tr>
</table>
<br/>
<cfinput type="submit" name="submit" value="Submit">
</cfform><!--- The following code retrieves all of the employee information for the user name entered on the form page. --->
<cfquery name="getEmpInfo" datasource="cfdocexamples">
SELECT * FROM EMPLOYEES
WHERE EMAIL = <cfqueryparam value="#FORM.username#">
</cfquery>
<!--- The following code populates the template called "employeeInfoHTTP.pdf" with data from the query. As in the previous example, notice the use of the cfpdfsubform tag. The txtEmpID field is a hidden field on the PDF form. --->
<cfquery name="getEmpInfo" datasource="cfdocexamples">
SELECT * FROM EMPLOYEES
WHERE EMAIL = <cfqueryparam value="#FORM.username#">
</cfquery>
<cfpdfform source="c:\forms\employeeInfoHTTP.pdf" action="populate">
<cfpdfsubform name="form1">
<cfpdfformparam name="txtFirstName" value="#getEmpInfo.FIRSTNAME#">
<cfpdfformparam name="txtLastName" value="#getEmpInfo.LASTNAME#">
<cfpdfformparam name="txtDeptName" value="#getEmpInfo.DEPARTMENT#">
<cfpdfformparam name="txtEmail" value="#getEmpInfo.IM_ID#">
<cfpdfformparam name="txtPhoneNum" value="#getEmpInfo.PHONE#">
<cfpdfformparam name="txtEmpID" value="#getEmpInfo.Emp_ID#">
</cfpdfsubform>
</cfpdfform><!--- The following code reads the form data from the PDF form and uses it to update
corresponding fields in the database. --->
<cfquery name="updateEmpInfo" datasource="cfdocexamples">
UPDATE EMPLOYEES
SET FIRSTNAME = "#FORM1.SUBFORM.HEADER.TXTFIRSTNAME#",
LASTNAME = "#FORM1.SUBFORM.HEADER.TXTLASTNAME#",
DEPARTMENT = "#FORM1.SUBFORM.HEADER.TXTDEPTNAME#",
IM_ID = "#FORM1.SUBFORM.HEADER.TXTEMAIL#",
PHONE = "#FORM1.SUBFORM.HEADER.TXTPHONENUM#"
WHERE EMP_ID = <cfqueryparam value="#FORM1.SUBFORM.TXTEMPID#">
</cfquery>
<h3>Employee Information Updated</h3>
<p><cfoutput>#FORM1.SUBFORM.HEADER.TXTFIRSTNAME#</cfoutput>,</p>
<p>Thank you for updating your employee information in the employee database.</p><h3>Employee Login Form</h3>
<p>Please enter your user name and password.</p>
<cfform name="loginform" action="embed2.cfm" method="post">
<table>
<tr>
<td>user name:</td>
<td><cfinput type="text" name="username" required="yes"
message="A user name is required."></td>
</tr>
<tr>
<td>password:</td>
<td><cfinput type="password" name="password" required="yes"
message="A password is required."></td>
</tr>
</table>
<br/>
<cfinput type="submit" name="submit" value="Submit">
</cfform><cfquery name="getEmpInfo" datasource="cfdocexamples">
SELECT * FROM EMPLOYEES
WHERE EMAIL = <cfqueryparam value="#FORM.username#">
</cfquery>
<!--- The following code creates a PDF document with headers and footers.
--->
<cfdocument format="pdf">
<cfdocumentitem type="header">
<font size="-1" align="center"><i>Nondisclosure Agreement</i></font>
</cfdocumentitem>
<cfdocumentitem type="footer">
<font size="-1"><i>Page <cfoutput>#cfdocument.currentpagenumber# of#cfdocument.totalpagecount#</cfoutput></i></font>
</cfdocumentitem>
<!--- The following code creates the first section in the PDF document. --->
<cfdocumentsection>
<h3>Employee Nondisclosure Agreement</h3>
<p>Please verify the information in the enclosed form. Make any of the necessary changes
in the online form and click the <b>Print</b> button. Sign and date the last page. Staple
the pages together and return the completed form to your manager.</p>
</cfdocumentsection>
<!--- The following code embeds an interactive PDF form within the PDF document with fields
populated by the database query. The cfpdpfform tag automatically creates a section in
the PDF document. Do not embed the cfpdfform within cfdocumentsection tags. --->
<cfpdfform action="populate" source="c:\forms\embed.pdf">
<cfpdfsubform name="form1">
<cfpdfformparam name="txtEmpName"
value="#getEmpInfo.FIRSTNAME# #getEmpInfo.LASTNAME#">
<cfpdfformparam name="txtDeptName" value="#getEmpInfo.DEPARTMENT#">
<cfpdfformparam name="txtEmail" value="#getEmpInfo.IM_ID#">
<cfpdfformparam name="txtPhoneNum" value="#getEmpInfo.PHONE#">
<cfpdfformparam name="txtManagerName" value="Randy Nielsen">
</cfpdfsubform>
</cfpdfform>
<!--- The following code creates the last document section. Page numbering resumes in this section. --->
<cfdocumentsection>
<p>I, <cfoutput>#getEmpInfo.FIRSTNAME# #getEmpInfo.LASTNAME#</cfoutput>, hereby attest
that the information in this document is accurate and complete.</p>
<br/><br/>
<table border="0" cellpadding="20">
<tr><td width="300">
<hr/>
<p><i>Signature</i></p></td>
<td width="150">
<hr/>
<p><i>Today's Date</i></p></td></tr>
</table>
</cfdocumentsection>
</cfdocument><!--- supplyReq1.cfm --->
<!--- The following code prefills fields in a blank form in LiveCycle and writes the prefilled
form to a new file called NewRequest.pdf in the supplyReqs directory. --->
<cfpdfform source="SupplyReq.pdf" action="populate" destination="supplyReqs/NewRequest.pdf"
overwrite="yes">
<cfpdfsubform name="form1">
<cfpdfformparam name="txtContactName" value="Constance Gardner">
<cfpdfformparam name="txtCompanyName" value="Wild Ride Systems">
<cfpdfformparam name="txtAddress" value="18 Melrose Place">
<cfpdfformparam name="txtPhone" value="310-654-3298">
<cfpdfformparam name="txtCity" value="Hollywood">
<cfpdfformparam name="txtStateProv" value="CA">
<cfpdfformparam name="txtZipCode" value="90210">
</cfpdfsubform>
</cfpdfform>
<!--- The following code lets users choose an existing supply request form or create a new
request from the NewRequest.pdf form. --->
<h3>Office Supply Request Form</h3>
<p>Please choose the office supply request form that you would like to open. Choose <b>New
Supply Request</b> to create a request.</p>
<!--- The following code populates a list box in a form with files located in the specified
directory. --->
<cfset thisDir = expandPath(".")>
<cfdirectory directory="#thisDir#/supplyReqs" action="list" name="supplyReqs">
<cfif #supplyReqs.name# is "NewRequest.pdf">
<cfset #supplyReqs.name# = "---New Supply Request---">
</cfif>
<cfform name="fileList" action="supplyReq2.cfm" method="post">
<cfselect name="file" query="supplyReqs" value="name" display="name"
required="yes" size="8" multiple="no"/><br/>
<cfinput type="submit" name="submit" value="OK">
</cfform>
<!--- supplyReq2.cfm --->
<!--- The following code displays the PDF form that the user selected. --->
<cfif #form.file# is "---New Supply Request---">
<cfset #form.file# = "NewRequest.pdf">
</cfif>
<cfpdfform source="supplyReqs/#form.file#" action="populate"/>
<!--- supplyReq3.cfm --->
<!--- The following code reads the PDF file content from the submitted PDF form. --->
<cfpdfform source="#PDF.content#" action="read" result="fields"/>
<!--- The following code writes the PDF form to a file and overwrites the file if it exists. --->
<cfpdfform action="populate" source="#PDF.content#" destination="SupplyReqs/supplyReq_#fields.form1.txtRequestNum#.pdf" overwrite="yes"/>
<!--- The following code customizes the display based on field values extracted from the PDF
form. --->
<p><cfoutput>#fields.form1.txtRequester#</cfoutput>,</p>
<p>Your changes have been recorded for supply request <cfoutput>#fields.form1.txtRequestNum#</cfoutput>.</p>
<p>If the form is complete and you would like to submit it to <cfoutput>#fields.form1.txtContactName#</cfoutput> for processing, click <b>Submit</b>.
<!--- The following code gives the option to e-mail the submitted form as an attachment or
return to the home page. --->
<cfform name="send" method="post" action="supplyReq4.cfm">
<cfinput type="hidden"
value="SupplyReqs/supplyReq_#fields.form1.txtRequestNum#.pdf" name="request">
<cfinput type="hidden" value="#fields.form1.txtRequester#" name="requester">
<cfinput type="submit" value="Submit" name="Submit">
</cfform>
<p>If you would like to modify your request or choose another request,
<a href="supplyReq1.cfm">click here</a>.</p>
<!--- supplyReq4.cfm --->
<!--- The following code sends the completed PDF form as an attachment to the person
responsible for processing the form. --->
<p>Your request has been submitted.</p>
<cfmail from="#form.requester#@wildride.com" to="cgardener@wildride.com"
subject="see attachment">
Please review the attached PDF supply request form.
<cfmailparam file="#form.request#">
</cfmail>