Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run URL in the background

Status
Not open for further replies.

paoloc

IS-IT--Management
Aug 14, 2002
14
0
0
US
Hi,
Using CF5 Is it possible to do accomplish the following?
I have a loop which executes a couple of queries and then needs to run a specific URL using the data prepared by the previous query for each loop iteration and displays its result in a different target window.

<cfloop ....>
<cfquery .....></cfquery>

....Here I need to execute the command via a URL....
Currently I use:

<script>

function openpopup(){
var popurl=&quot;URL_2_Execute_Here&quot;
winpops=window.open(popurl,&quot;&quot;,&quot;width=800,height=600,resizable,&quot;)
}

openpopup()

</script>

</cfloop>


But it seems a bit quirky... Is there an alternative to this?

Tks/Rgds
__PC
 
Sounds like about the best way to do it.
It also sounds like a mess for the user, opening up a bunch of popup windows for different bits of information... but, who am I to ask ;-)

The only way I can think of doing it in pure ColdFusion server-side would be to use CFHTTP... and then you'd never see the results. So Javascript is probably your best bet.

You could, however, do away with the openpopup() function and just call window.open directly. You could even have window.open call the same .CFM page... just pass it a URL parameter to tell the page which query to run:

Code:
<script>

query1=window.open(&quot;runquery.cfm?query=query1&quot;,&quot;&quot;,&quot;width=800,height=600,resizable=yes&quot;);
query2=window.open(&quot;runquery.cfm?query=query2&quot;,&quot;&quot;,&quot;width=800,height=600,resizable=yes&quot;);
query3=window.open(&quot;runquery.cfm?query=query3&quot;,&quot;&quot;,&quot;width=800,height=600,resizable=yes&quot;);

</script>

then runquery.cfm would be:

Code:
<CFPARAM name=&quot;URL.query&quot; default=&quot;query1&quot;>

<CFQUERY ... >
<CFSWITCH expression=&quot;#URL.query#&quot;>
<CFCASE value=&quot;query1&quot;>
   <!--- SQL for query 1 goes here --->
   SELECT *
    FROM ...
</CFCASE>
<CFCASE value=&quot;query2&quot;>
   <!--- SQL for query 2 goes here --->
   SELECT *
    FROM ...
</CFCASE>
<CFCASE value=&quot;query3&quot;>
   <!--- SQL for query 3 goes here --->
   SELECT *
    FROM ...
</CFCASE>
</CFSWITCH>
</CFQUERY>


-Carl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top