Skip to main content
New Participant
August 31, 2010
Answered

How to populate dynamic table in Adobe Livecycle form with cfpdfform?

  • August 31, 2010
  • 1 reply
  • 3387 views

Hello all,

after two days search on the above topic without results I hope someone here can help me.

The problem:

I have an Adobe PDF form created with Adobe Livecycle Designer that has a dynamic table inside it. The table Table1 consists of a Header Row with 4 cells of text and a data row Row1 with four cells each one having a Textfield Cell1, Cell2,Cell3 and Cell4.

Table1 sits inside a subform mytable. The subform is made to flow and the Row1 has the Binding Repeat Row for Each Data Item checked.

Everything is enclosed within the standard subform form1.

Whe I use the following code, I supposed that the table should have two rows..because it is said it will be dynamic:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<cfpdfform action="populate" source="test.pdf" destination="testout.pdf" overwrite="yes" >
<cfpdfsubform name="form1">
  <cfpdfsubform name="mytable">
    <cfpdfsubform name="Table1">
      <cfpdfsubform name="Row1">
        <cfpdfformparam name="Cell1" value="1">
        <cfpdfformparam name="Cell2" value="2">
        <cfpdfformparam name="Cell3" value="3">
        <cfpdfformparam name="Cell4" value="4">
      </cfpdfsubform>
      <cfpdfsubform name="Row2">
        <cfpdfformparam name="Cell1" value="5">
        <cfpdfformparam name="Cell2" value="6">
        <cfpdfformparam name="Cell3" value="7">
        <cfpdfformparam name="Cell4" value="8">
      </cfpdfsubform>
    </cfpdfsubform>
  </cfpdfsubform>
</cfpdfsubform>
</cfpdfform>


<cfpdfform action="read" source="testout.pdf" result="testout" />
<cfdump var="#testout#">
</body>
</html>

What happes is:

The testout.pdf displays just one row,with the values 1,2,3,4 the second row is only visible when I export the data as xml but not within the PDF.

Please can someone enlighten me?

Thanks and regards

Gilbert

    This topic has been closed for replies.
    Correct answer

    When populating your pdf fields, you can loop through all the records in a query like so...

       <cfloop from="1" to="#query1.recordCount#" index="i">
                <cfpdfformparam name="txtField1_#i#" value="#query1.Field1#">
                <cfpdfformparam name="txtField2_#i#" value="#query1.Field2#">
      </cfloop>

    This will handle two rows or thirty rows just the same.  In this case my fields in the pdf have the row # as a suffix.

    1 reply

    Correct answer
    September 3, 2010

    When populating your pdf fields, you can loop through all the records in a query like so...

       <cfloop from="1" to="#query1.recordCount#" index="i">
                <cfpdfformparam name="txtField1_#i#" value="#query1.Field1#">
                <cfpdfformparam name="txtField2_#i#" value="#query1.Field2#">
      </cfloop>

    This will handle two rows or thirty rows just the same.  In this case my fields in the pdf have the row # as a suffix.

    New Participant
    September 6, 2010

    Perfect, that does it. Thanks a lot.

    Quoting brambilaa <forums@adobe.com>:

    When populating your pdf fields, you can loop through all the

    records in a query like so...

     

       <cfloop from="1" to="#query1.recordCount#" index="i">

                <cfpdfformparam name="txtField1_#i#" value="#query1.Field1#">

                <cfpdfformparam name="txtField2_#i#" value="#query1.Field2#">

      </cfloop>

     

    This will handle two rows or thirty rows just the same.  In this

    case my fields in the pdf have the row # as a suffix.

    >