Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript code will not execute if a cfdocument tag is in my document

Status
Not open for further replies.

LyndonOHRC

Programmer
Sep 8, 2005
603
US
I have a popup form action page that opens by using the form/target="_blank" attribute.


The new document does a database insert and then creates a PDF using the <cfdocument> tag.


I'm trying update some elements on the parent/opener form page as it is common for the client to continue using the parent, make some changes, and generate another PDF. If I comment out the <cfdocument> tag my code works fine, the parent document is updated as I expected.


I'm not sure how to proceed, help much appreciated!


thanks, Lyndon


Javascript I'm trying to run just before the <cfdocument> tag:

Code:
<script>

        window.opener.document.getElementById('photoListTitle').innerHTML='test update';

</script>

Tag Attributes:
Code:
<cfdocument

        localUrl="yes"

        format="PDF"

        pageType="custom"

        pageWidth="2.2"

        pageHeight="3.375"

        marginBottom="0"

        marginTop="0"

        marginLeft="0"

        marginRight="0"

        orientation="portrait"

        backgroundVisible="yes"

        fontEmbed ="true"

        filename="PDFs/#Replace(BadgPhotoName,'.jpg','.pdf','All')#"

        overwrite="true">

          some simple html...

</cfdocument>

Lyndon
 
Solved it.

It seems that if a cfinclude tag or cflocation tag calls a template that contains a <cfdocument> tag then javascript cannot access the window.opener document because the PDF is not html. That's my best guess anyway.

I solved this issue by using an <iframe src=""> tag. That way the action page for my form can access/modify the window.opener.document then execute my <cfdocument> template.


Lyndon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top