?
Solved

meta tags

Posted on 2004-08-06
5
Medium Priority
?
692 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1600 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to Import and export files in WordPress. 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 : Click on Too…
Suggested Courses

770 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