Adobe COLDFUSION 9 Manual page 929

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
On the first processing page, a query retrieves all of the information associated with the user name from the
cfdocexamples database. The
timesheetForm.pdf) with the employee name, phone number, e-mail address, and department. ColdFusion displays
the populated form in the browser, where the employee can complete the form and submit it.
<!--- 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>
When the user completes the timesheet form (by filling in the time period, projects, and hours for the week) and clicks
the Submit button, Acrobat sends the PDF file in binary format to a second ColdFusion processing page.
Note: In LiveCycle Designer, use the standard Submit button on the PDF form and specify "submit as: PDF" in the button
Object Properties. Also, ensure that you enter the URL to the ColdFusion processing page in the Submit to URL field.
The
tag
action reads the PDF content into a result structure named
cfpdfform
read
action writes the completed form to a file in the timesheets subdirectory.
populate
tag populates an associated PDF form created in LiveCycle Designer (called
cfpdfform
Last updated 8/5/2010
. The
tag
fields
cfpdfform
924

Advertisement

Table of Contents
loading

Table of Contents