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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run query when clicking a link?

Status
Not open for further replies.

EastIndian

Technical User
Mar 21, 2002
18
0
0
US
Any help is appreciated:

This seems really simple, but I can't seem to get it (still a beginner...)

I have a link that opens an rtf file (MS Word Mailing Labels/Custom tag). I would like to run a query that updates the background database with info that the file has been opened--I only want to run the query when the file is opened. My question is how do I program this? Is it an on click event? Currently, I have the link that opens the file:
<cfoutput>To print the current labels, <a href=&quot;//path/#labelfile#&quot;>Click here</a></cfoutput>

and the query, but I am not sure how to make the query run only when the file is opened.

Thanks in advance,
Brandy
 
You might want to make that link open a new coldfusion template.
That new template can run the query for you, and open the file for you.

When the link is clicked to 'view file (click here)' it takes the user to a cfm template. The query is run, and the file is then opened, or the file is opened, then the query is run, however you like.

you could use a javascript popup window to display the rtf file. (internet explorer will show it in browser, most others will download it, or open it in word, or an rtf viewer.)

hope that helps

 
Great suggestion, I can do that. But, the file I am opening is named by the date and time it was created. I would like to open only the most recent file (named by date and time) Would I use CFFILE to open the file in the new template? How do I write that if the file name can not be hard coded?
Thank you.

 
<cfdirectory name=&quot;getList&quot; action=&quot;LIST&quot; directory=&quot;c:\&quot; sort=&quot;datelastmodified DESC&quot; filter=&quot;*.rtf&quot;>

<cfoutput query=&quot;getList&quot; maxrows=&quot;1&quot;>
#name# #datelastmodified#<br>
</cfoutput>

That should get what you want. Use the correct directory though!
now you have the filename of the newest rtf file in the folder. if the folder is accessable by the web page, you can link directly to the filename (or do a java popup to ensure that the file is opened, because the query was ran.)

I have some questions for you:

How are the files created? what is the purpose of the query to be ran? are the rtf files used be other programs?



 
The files are created from a custom tag to create mailing labels (Copyright 2000-2002 Brian Ghidinelli <brian @ vfive.com>)that I got off the Macromedia site.

I have a form that allows users to request a product (it happens to be a map). They enter their name, mailing address etc. Each day, a set of mailing labels are created for all of the new requests. An e-mail is generated telling the admin person that either there are new requests and labels must be printed, or that there are no new requests. The e-mail contains a link to print the current labels and a link to view all of the historic files created. The rtf files are only to be used in Word.

Thanks so much for your help. I'm going to see if I can make it work now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top