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:

Thank you.

IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?
Jerry_PangConnect With a Mentor Commented:
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.


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



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

<body color="#FFFFFF">

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


In your code, have something like this:

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

Of course, in a real environment, change to something else in the <a> tag and the <meta> tag. The 3 is for 3 seconds.

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 ...

   <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#">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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>">

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


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

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

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

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.
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.
<cfset URLEncodedFormat(MYMESSAGE = "Your request is being Processed..Please wait.")>

change this to

 <cfset MYMESSAGE = URLEncodedFormat("Your request is being Processed..Please wait.")>
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.