Solved

meta tags

Posted on 2004-08-06
5
644 Views
Last Modified: 2013-12-24
How can I Use Coldfusion and HTML Meta TAGS To Make A Dynamic Delay Message?

When the user hits submit on a form, I want it to go to a "Thank You" page and after a few seconds redirect to another page.

This site does it in ASP: http://www.powerasp.com/content/hintstips/dynamic-meta-refresh.asp

Thank you.

0
Comment
Question by:Isaac
  • 2
  • 2
5 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 11738310
Hi

In your code, have something like this:

<html>
<head>
<title>Thank You</title>
<meta http-equiv="refresh" content="3;url=http://www.google.com/">
</head>
<body>
Thank your submitting this form. You will be automatically redirected to the login page. If it doesn't work, click <a href="http://www.google.com/">here</a>.
</body>
</html>

Of course, in a real environment, change http://www.google.com to something else in the <a> tag and the <meta> tag. The 3 is for 3 seconds.


Regards,
Zyloch
0
 
LVL 5

Author Comment

by:Isaac
ID: 11738495
It's a little bit complicated than that.  This is my code:

when the user hits submit, it goes to a process page:

<cfquery datasource="d1">
     Insert ...
</cfquery>

   <cfset URLEncodedFormat(MYMESSAGE = "Your request is being Processed..Please wait.")>
   <CFSET direct="edit.cfm?bookNum=#session.booknum#&case=#session.topic_title#&owner=#session.owner#">
    <cflocation url="Confirm.cfm?DELAY_TIME=2&Delay_msg=#MYMESSAGE#&redirectURL=#direct#">


confirm.cfm:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<cfif isdefined("DELAY_TIME")>
      <cfset delay_time = '#URL.DELAY_TIME#'>
      <cfset redirectURL = '#URL.redirectURL#'>
      <cfset delay_msg = '#URL.Delay_msg#'>
      <meta http-equiv="Refresh" content="<cfoutput>#delay_time#</cfoutput>; URL=<CFOUTPUT>#redirectURL#</CFOUTPUT>">
</CFIF>

<title>Untitled Document</title>
<script type="text/javascript" src="/library/js/stylesheet.js"></script>

</head>

<body>
<cfinclude template="/includes/header.cfm">

<font face="Arial"><p align = "center"><strong><cfoutput>#delay_msg#</cfoutput></strong></p></font>

<cfinclude template="/includes/footer.cfm">
</body>
</html>

After all this, I get the error:

Error Occurred While Processing Request  
Error casting an object of type to an incompatible type. This usually indicates a programming error in Java, although it could also mean you have tried to use a foreign object in a different way than it was designed.  


When I take out the "URLEncodedFormat()" in
<cfset URLEncodedFormat(MYMESSAGE = "Your request is being Processed..Please wait.")>

just the first variable in the url (editSection.cfm?bookNum) shows.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11739849
Try this:

<cfset MYMESSAGE = "Your request is being Processed..Please wait.">
<CFSET direct="edit.cfm?bookNum=#session.booknum#&case=#session.topic_title#&owner=#session.owner#">
<cflocation url="Confirm.cfm?DELAY_TIME=2&Delay_msg=#URLEncodedFormat(MYMESSAGE)#&redirectURL=#URLEncodedFormat(direct)#">


In truth, I doubt the fact that you only get the first variable in editSection.cfm is because of URLEncodedFormat. It's because of the fact that in that URL are '&' which to the browser separates parameters in the Confirm.cfm URL. I'm not too sure if URLEncodedFormat will help direct, but I'm hoping it will.
0
 
LVL 9

Accepted Solution

by:
Jerry_Pang earned 400 total points
ID: 11741246
I just converted the ASP page to coldfusion, i copy paste most of the page that you gave.
This is the coldfusion equivalent of that page.


Put this at the top of your page before the <HTML> Tag.
<cfset Response.Buffer = True>

Then when you are ready to send the user to the delay page do something like this.

<cfset MYMESSAGE = #URLEncodedformat("Adding New Product....Please Wait")#>
<cflocation url = "delay.cfm?DELAY_TIME=3&DELAY_MESSAGE=" & #MYMESSAGE# & "&REDIRECT_URL=default.cfm">

As you see can see there are 3 variables we send to the delay page.

DELAY_TIME
REDIRECT_URL
DELAY_MESSAGE

Then the delay.cfm page would consist of the following code.

<cfset DELAY_TIME = url.DELAY_TIME>
<cfset REDIRECT_URL = url.REDIRECT_URL>
<cfset DELAY_MESSAGE = url.DELAY_MESSAGE>

<html>

<head>
<meta http-equiv="Refresh" content="<cfoutput>#DELAY_TIME#</cfoutput>; URL=<cfoutput>#REDIRECT_URL#</cfoutput>">
<title>Delay</title>
</head>

<body color="#FFFFFF">

<font face="Arial"><p align = "center"><strong><cfoutput>#DELAY_MESSAGE#</cfoutput></strong></p></font>

</body>
</html>
0
 
LVL 9

Expert Comment

by:Jerry_Pang
ID: 11741251
<cfset URLEncodedFormat(MYMESSAGE = "Your request is being Processed..Please wait.")>

change this to

 <cfset MYMESSAGE = URLEncodedFormat("Your request is being Processed..Please wait.")>
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

862 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

23 Experts available now in Live!

Get 1:1 Help Now