Solved

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

Posted on 2004-10-28
141 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
Question by:geraldw
    2 Comments
     
    LVL 17

    Accepted Solution

    by:
    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
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Scale it in WD Gold

    With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

    A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
    When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
    The purpose of this video is to demonstrate how to properly insert a Vimeo Video into a WordPress site or Blog. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp…
    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…

    846 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

    Need Help in Real-Time?

    Connect with top rated Experts

    3 Experts available now in Live!

    Get 1:1 Help Now