0

Thank you in advance to anyone who can help this coldfusion noob.

What I am trying to do seems easy enough but clearly I am having very serious problems. ;D

I am trying to populate a pdf with data from a database.


//Here is the page that lists all the users and allows a link to the user details
//this is working fine

<cfquery name="GetUsers" datasource="[ommitted]"> 
    SELECT ChildAssessmentID,FirstName, LastName
    FROM ChildAssessments 
   
</cfquery> 
<h4>Child Assessment List</h4> 
<table> 
<tr> 
<th>User ID</th>
<th>First Name</th> 
<th>Last Name</th> 

</tr> 
<cfoutput query="GetUsers"> 
<tr> 
<td><a href="pdf.cfm?ChildAssessmentID=#ChildAssessmentID#">#ChildAssessmentID#</a></td>
<td>#FirstName#</td> 
<td>#LastName#</td> 

</tr> 
</cfoutput> 
</table>

//end page

//Here is my query getting the details of user with the ChildAssessmentID
//this seems to be making the correct query but is not working with the pdf

<cfquery name="getuserdetails" datasource="[omitted]">
  select FirstName, LastName
  from ChildAssessments where ChildAssessmentID=#URL.ChildAssessmentID#
</cfquery>

Here is my cfpdfform code
//pdf.cfm

<cfpdfform action="populate" source="pdf/testform.pdf" overwrite="yes">
	<cfpdfsubform name="form1" >
		<cfpdfformparam name="ChildAssessmentID"  value="#URL.ChildAssessmentID#">
		 <cfpdfformparam name="FirstName" value="#getuserdetails.FirstName#">
            <cfpdfformparam name="LastName" value="#getuserdetails.LastName#">
		
	</cfpdfsubform>
</cfpdfform>

The form I am trying to populate (pdftestform.pdf) displays the top record in LiveCycleDesigner using "Preview Mode", but does not display data using the coldfusion.

I hope this makes sense.

4
Contributors
15
Replies
18
Views
6 Years
Discussion Span
Last Post by jsmall26
0

Thank you cfwebedeveloper.
Yes, I've tried the cfdocument tag, and it is creating pdf forms for me, but I'd like to get data from a database to populate the pdf form based on the user id that is passed in the url.

0

Not a dumb question. Thank you. I had to double check. Yes. It is dumping the query based on userID passed in URL. I can't figure out why it won 't appear in a pdf. It seems like I'm so close.

thanks again!

0

Are you sure you are getting results back from the database? Sounds like you are getting no results back from the database. Do a quick cfoutput of getuserdetails.recordcount and see if it 0 or 1.

0

Weird...I will try to replicate this once I get home from work. I havn't messed with cfpdfform before but would be nice to figure out this issue.

0

Yes, I've tried the cfdocument tag, and it is creating pdf forms for me, but I'd like to get data from a database to populate the pdf form based on the user id that is passed in the url.

Huh? ;) cfdocument doesn't create or populate forms. But you can populate forms with cfpdfform.

0

Hi - Thanks for everyones help. I did resolve my problem. Using the example from adobe cfdeveloper pointed out.
Complete Total user error. The Adobe documentation is correct.

0

Hi - Thanks for everyones help. I did resolve my problem. Using the example from adobe cfdeveloper pointed out.
Complete Total user error. The Adobe documentation is correct.

Oh, I believed cfpdfform would work. It was the talk about cfdocument and forms that had me scratching my head ;-) Glad it's resolved.

0

Wrap the whole page, query and all, in the cfdocument tag. It should be the first line and last lines of the whole page. Make sure your variables that are passed are scoped with the url/cookie/session. I create dynamic pdf's all the time and this problem the first time I tried it.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.