Since we lost our CF Webmaster, I've been duped into filling in...it's only been 4 years now....and I know very, very little about CF.....excuse my ignorance.
We use CF for our intranet site and I was trying to see if I could get rid of a pop-up window when a client requested a specific report. The window is being blocked by the IE pop-up blocker (or even the google tool bar) and it's killing me with support calls. I'd like the report to display in the SAME window, but I don't know how to change the behavior. The following is the code to generate the page and display the report:
How can I stop the report from opening up in a new window?
We use CF for our intranet site and I was trying to see if I could get rid of a pop-up window when a client requested a specific report. The window is being blocked by the IE pop-up blocker (or even the google tool bar) and it's killing me with support calls. I'd like the report to display in the SAME window, but I don't know how to change the behavior. The following is the code to generate the page and display the report:
<CFSET cPageTitle = "Central System Reports">
<CFSET cMyInitials = "JGB">
<CFOUTPUT>
<!-- Content manager: #cMyInitials# -->
<CFINCLUDE TEMPLATE="#cSiteLogicalRoot#/includes/topstuff.inc">
<HTML>
<HEAD>
<CFINCLUDE TEMPLATE="#cSiteLogicalRoot#/includes/headstuff.inc">
<TITLE>#cPageTitle#</TITLE>
</HEAD>
<BODY>
<CFINCLUDE TEMPLATE="#cSiteLogicalRoot#/includes/bodystuff.inc">
<CFINCLUDE TEMPLATE="#cSiteLogicalRoot#/includes/mainmenu.inc">
<CFINCLUDE TEMPLATE="#cSiteLogicalRoot#/includes/header01.inc">
<!--- Initialize --->
<CFSET cDirectory = "d:\data\csreports">
<CFSET cVirtualDirectory = "/content/rep/pdfs/csreports">
<CFSET cThisScript = "#CGI.SCRIPT_NAME#">
<CFSET bShowSearchForm = "NO">
<CFPARAM NAME="FORM.cSearchString" DEFAULT="">
<CFPARAM NAME="FORM.cInitLetter" DEFAULT="">
<CFPARAM NAME="FORM.cFileName" DEFAULT="">
<!-- Content table begins -->
<TABLE class="content_table" border="0">
<TR>
<TD class="content_table" width="75%">
<!-- #################################### -->
<!-- #### BEGIN ADDING CONTENT HERE! #### -->
<!---
PSEUDOCODE
IF [search string passed] OR [letter passed]
Query directory for all filenames containing search string OR beginning with initial letter
Compile filename list
IF list has zero elements
Inform user
Set search form flag
ELSEIF list has only one element
Put it in hidden filename field
Invoke this form again
ELSE
Create dropdown list
ENDIF
ELSEIF [filename passed]
Display file
Set search form flag
ENDIF
IF search form flag set
Construct search form
ENDIF
--->
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="CENTER" valign="MIDDLE">
<tr><td>
<CFIF (Len(FORM.cSearchString) GT 0) OR (Len(FORM.cInitLetter) GT 0)>
<!--- If we got a search string or initial letter, find the matching files --->
<!--- Get listing of csreports directory --->
<CFDIRECTORY ACTION="LIST" DIRECTORY="d:\Data\csreports" NAME="qFiles" SORT="name">
<!--- Put all matches in a list --->
<CFSET lFiles = "">
<CFLOOP QUERY="qFiles">
<CFIF (Len(FORM.cSearchString) GT 0)>
<!--- Match on search string --->
<CFIF qFiles.name contains "#FORM.cSearchString#">
<CFSET lFiles = ListAppend(lFiles, "#UCase(qFiles.name)#")>
</CFIF>
<CFELSEIF (Len(FORM.cInitLetter) GT 0)>
<!--- Match on first letter --->
<CFIF Left(qFiles.name,1) IS "#FORM.cInitLetter#">
<CFSET lFiles = ListAppend(lFiles, "#UCase(qFiles.name)#")>
</CFIF>
</CFIF>
</CFLOOP>
<!--- How many filenames in list? --->
<CFSET nNumberOfFiles = ListLen(lFiles)>
<!--- Handle list --->
<CFIF nNumberOfFiles IS 0>
<!--- No files... Danger, Will Robinson! --->
<H3>There are no Central System Reports that match your search. Please try again.</H3>
<CFSET bShowSearchForm = "YES">
<CFELSEIF nNumberOfFiles IS 1>
<!--- One file... Pass it on --->
<H3>Autosubmit...</H3>
<FORM ACTION="#cThisScript#" METHOD="post" NAME="selectfile" ID="selectfile">
<INPUT TYPE="hidden" NAME="cFileName" ID="cFileName" VALUE="#lFiles#">
<INPUT TYPE="hidden" NAME="newWindow" value="yes">
</FORM>
<!--- Autosubmit this form --->
<SCRIPT LANGUAGE="JavaScript1.2">this.document.selectfile.submit();</SCRIPT>
<CFELSEIF nNumberOfFiles GT 1>
<!--- Many files... Pick one and pass it on --->
<!--- Construct dropdown list --->
<H2>Select a report to display:</H2>
<FORM ACTION="#cThisScript#" METHOD="post" NAME="selectfile" ID="selectfile">
<SELECT NAME="cFileName" ID="cFileName">
<CFLOOP INDEX="cThisFile" LIST="#lFiles#">
<OPTION VALUE="#cThisFile#">#cThisFile#</OPTION>
</CFLOOP>
</SELECT>
<INPUT TYPE="hidden" NAME="newWindow" value="yes">
<INPUT TYPE="submit" NAME="selectfile" ID="selectfile" VALUE="Go" CLASS="teeny">
</FORM>
</CFIF>
<CFELSEIF (LEN(FORM.cFileName) GT 0)>
<!--- Got the file... show it! --->
<H2>Central Systems Report<BR>#cFileName#</H2>
</td></tr>
<CF_PDFSHOW pcDefaultPDF="#cVirtualDirectory#/#cFileName#">
<CFSET bShowSearchForm = "YES">
<CFELSE>
<!--- Nothing else happening... show the search form --->
<CFSET bShowSearchForm = "YES">
</CFIF>
<CFIF bShowSearchForm>
<!-- Search form -->
<TR><TD><BR><H2>Central Systems Search</H2>
<!-- Search by string -->
<P><FORM ACTION="#cThisScript#" METHOD="post" NAME="selectstring" ID="selectstring">
Enter company name, system name, or city:<INPUT TYPE="text" NAME="cSearchString" SIZE="20" MAXLENGTH="999">
<!--- Search by first letter --->
<BR> ...or...<BR>
Select first letter of company name:
<SELECT NAME="cInitLetter">
<!--- Construct alphabet dropdown --->
<CFLOOP INDEX="ltr" FROM="65" TO="90">
<OPTION VALUE="#Chr(ltr)#">#Chr(ltr)#</OPTION>
</CFLOOP>
</SELECT>
<BR><INPUT TYPE="submit" NAME="cssearch" ID="cssearch" VALUE="Search" class="teeny" STYLE="margin-left:5em;margin-top:1em;">
</FORM></P>
</CFIF>
</td></tr>
</table>
</CFOUTPUT>
<!-- #### END CONTENT HERE! #### -->
<!-- ########################### -->
</tr>
</TABLE>
<!-- Content table ends -->
<CFINCLUDE TEMPLATE="#cSiteLogicalRoot#/includes/footer01.inc">
<CFINCLUDE TEMPLATE="#cSiteLogicalRoot#/includes/endbody.inc">
</BODY>
</HTML>
How can I stop the report from opening up in a new window?
