Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Javascript and ColdFusion won't pop-up correct web page

Posted on 2004-10-28
3
Medium Priority
?
145 Views
Last Modified: 2013-12-24
Hello,

I'm not sure if I should have put this in the javascript or the CF section but here goes.

I'm using Cold Fusion MX on Win2003 (IIS6) with Oracle 8.0.3 DB on Unix (HPUX9.0.2).

I wrote a page to allow our consumers to search (Verity) the Archives.  This is a collection of documents that are removed from their 1st level place on the site and relegated to a folder of their own to keep them for consumers reference.  The folder structure is:

inetpub/wwwroot/thesite/archive
  archive.cfm
  searcharchive.cfm, etc.

inetpub/wwwroot/thesite/archive/ideaexchange
  bunch of docs.html...
inetpub/wwwroot/thesite/archive/tipsandtricks
  bunch of docs.html...

Our site is constructed of a bunch of <CFINCLUDE> tags and so although it appears to be one page to the browser it's actually about 7 different included pages.  So, I have the following page that was found when someone searched the archive.

http://130.175.58.77/index.cfm?page=archive/ideaexchange/ideas_010199.html
(the page= variable places the following page into the main window below all the navigation)..

So, the person clicks on the link and goes to view the page which is actually appearing through this set of <CFINCLUDE> tags.  I need them to be able to pop-up a separate window with JUST the archived page so that they can print it out and put it in their notebook.  I think that's where the problem starts.  I have this code in the found document.
_______________________________________
<cfset pageToPrint = #page#>
...
<script language="JavaScript1.2">
function newWindow(currentURL)
{
window.open("currentURL", "PrintWindow", "scrollbars=1,resizable=1,width=500,height=500")
}
</script>
</head>
. . .
<td align="right" nowrap class="bodyGeneral">
<cfoutput>
<a href="javascript:newWindow('http://130.175.58.77/#pageToPrint#');">PRINT THIS PAGE</a><br>

#PAGE# - JUST TO TEST THE VALUE (appears correctly in status bar when mouse is over the link)

</cfoutput>
<cfif http_referer CONTAINS "searchArchiveAction">
<p>
<strong><a href=javascript:history.back()>&lt;&lt;back to Archive</a></strong>
</p>      
<cfelse>
<p>
<strong><a href="index.cfm?page=archive/archive.cfm">&lt;&lt;back to Archive</a></strong>
</p>
</cfif>
</td>
________________________________________________

The #page# variable is coming from the URL to the previous page.  It appears to print out correctly as I said in the code comment above.

The problem is that I either get one of two results:

1.  I get a new pop-up window but the entire home page appears.  That is a pop-up window that shows exactly the site and NOT the page I was trying to send the person to.
2.  I get a Page Not Found error.

I think that because the #PAGE# variable shows the correct path I am simply not getting the right information to the javascript.  But it's really strange that as far as I can tell I'm sending the right thing but not being able to display ONLY the archive page.

Thanks in advance for your help.
Jerry



0
Comment
Question by:geraldw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 17

Accepted Solution

by:
Tacobell777 earned 750 total points
ID: 12439057
window.open("currentURL", "PrintWindow", "scrollbars=1,resizable=1,width=500,height=500")

without the quotes around currentURL

window.open(currentURL, "PrintWindow", "scrollbars=1,resizable=1,width=500,height=500")
0
 

Author Comment

by:geraldw
ID: 12718502
Tacobell777,

Sorry for the delay.  Honestly, it turned out to be something very different - that is it involved using a variable for the page name rather than the IP number, etc.  However, your answer is correct in that I shouldn't have used the double quotes in the question I submitted.  I had the thing working but it was really a matter of telling it which page to show and not the way I was sending the variables.  The double quotes were just one of those last ditch efforts to try something bizarre.  Nonetheless, thanks for reading it and your answer took time so I'm awarding you the points.
Jerry
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question