Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 706
  • Last Modified:

meta tags

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
Isaac
Asked:
Isaac
  • 2
  • 2
1 Solution
 
ZylochCommented:
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
 
IsaacSharePoint Client Side DeveloperAuthor Commented:
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
 
ZylochCommented:
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
 
Jerry_PangCommented:
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
 
Jerry_PangCommented:
<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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now