INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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

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

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close