• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

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

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
geraldw
Asked:
geraldw
1 Solution
 
Tacobell777Commented:
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
 
geraldwAuthor Commented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now