Description

Populates a subform within the cfpdfform tag.
The cfpdfsubform tag can be a child tag of the cfpdfform tag or nested in another cfpdfsubform tag.

History

ColdFusion 8: Added this tag.

Category

Syntax

<cfpdfform ..> 
<cfpdfsubform 
name = "field name" 
index = "integer"> 
</cfpdfsubform> 
</cfpdfform>

Note:

You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys.

See also

Attributes

Attribute

Req/Opt

Default

Description

index

Optional

1

Index associated with the field name. If multiple fields have the same name, ColdFusion uses the index value to locate one of them.

name

Required

 

Name of the subform corresponding to subform name in the PDF form.

Usage

Use the cfpdfsubform tag with the cfpdfform tag to populate one or more subforms within a PDF form. The cfpdfsubform tag can contain multiple cfpdfformparam tags. Also, you can nest subforms, as the following example shows:

<!--- This example shows how to nest cfpdfsubform tags. ---> 
<cfpdfform source="c:\payslipTemplate.pdf" 
destination="c:\employeeid123.pdf" action="populate"> 
<cfpdfsubform name="employeeDetail"> 
<cfpdfsubform name="address"> 
<cfpdfformparam name="txtAddLine1" value="572 Evergreen Terrace"> 
<cfpdfformparam name="txtCity" value="Springfield"> 
<cfpdfformparam name="txtState" value="Oregon"> 
<cfpdfformparam name="txtZip" value="65412"> 
<cfpdfformparam name="txtCountry" value="United States"> 
</cfpdfsubform> 
<cfpdfformparam name="txtEmployeeId" value="879104"> 
<cfpdfformparam name="numSalary" value="$85,000"> 
</cfpdfsubform> 
</cfpdfform>

Use subforms to match the exact structure of the source PDF form. If you do not, ColdFusion cannot prefill the form with data and generates an error. Many of the forms generated from templates in LiveCycle contain a subform called form1. You must specify this as a subform in your code, as the following example shows:

<cfpdfform source="c:\forms\timesheetForm.pdf" action="populate"> 
<cfpdfsubform name="form1"> 
<cfpdfformparam name="txtCompanyName" value="Adobe"> 
<cfpdfformparam name="txtManager" value="Randy Nielsen"> 
</cfpdfsubform> 
</cfpdfform>

To verify the structure of a PDF form in ColdFusion, use the read action of the cfpdfform tag, as the following example shows:

<cfpdfform source="c:\forms\timesheetForm.pdf" result="resultStruct" action="read"/>

Then use the cfdump tag to display the structure:

<cfdump var="#resultStruct#">

Example

See the cfpdfform tag examples.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy