Adobe COLDFUSION 9 Manual page 931

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Working with Documents, Charts, and Reports
<!--- 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>
When the employee updates the information in the form and clicks the HTTP post Submit button, Acrobat sends the
form data (but not the form itself) to a second ColdFusion processing page.
Note: In LiveCycle Designer, use the HTTP Submit button on the PDF form. Also, ensure that you enter the URL to the
ColdFusion processing page in the URL field of button Object Properties.
Reproduce the structure, not just the field name, when you reference form data. To determine the structure of the form
data, use the
tag.
cfdump
<!--- 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>
Embedded PDF form example
The following example shows how to embed an interactive PDF form in a PDF document created with the
tag.
cfdocument
On the login page, an employee enters a user name and password:
Last updated 8/5/2010
926

Advertisement

Table of Contents
loading

Table of Contents