ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 14th, 2005, 02:42 AM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 194 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 18 h 31 m 25 sec
Reputation Power: 0
Thumbs up Error when user hits back-CF 7 flash forms

As those who've started using CF 7 noticed when you use a flash form and the user hits back on the browser it makes a nasty little message that says "the form data has expired please refresh page" this looks super unproffessional.

Heres how to fix it.

Code:
<script language="javascript">

function refreshPage()
{
if(getCookie("refresh") == null)
{
window.location.reload(true);
setCookie("refresh", "refreshed");
}
else
{
setCookie("refresh", "");
}
}

function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}

function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}

</script>


Put this puppy in your <head> tag and your good to go.

-Alas

PS i just wasted 4 hours on this same problem ...i hope i saved somebody some time

Reply With Quote
  #2  
Old March 14th, 2005, 08:20 AM
kiteless kiteless is offline
Moderator
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 4,084 kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 10 h 42 m 46 sec
Reputation Power: 780
Dude, RTFM.

Look at the timeout attribute.

http://livedocs.macromedia.com/cold...htm&single=true

Wow don't you feel silly now wasting 4 hours on a solution that is totally unnecessary?

Seriously Alas, you seemed to know what you were doing but lately you're posting stuff that makes you look like a total noob. Get it together man!

Last edited by kiteless : March 14th, 2005 at 08:28 AM.

Reply With Quote
  #3  
Old March 14th, 2005, 09:59 AM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 194 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 18 h 31 m 25 sec
Reputation Power: 0
Touche...Couldve used the info during those 4 hours, but still i think that the timeout = X variable only puts the form the way the user left it ie. with the text he wrote in the boxes etc. How would u just reset the form this way, i still see my way as superior unless the timeout can accomplish this. Can it?

Reply With Quote
  #4  
Old March 14th, 2005, 10:12 AM
kiteless kiteless is offline
Moderator
Dev Shed Specialist (4000 - 4499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 4,084 kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level)kiteless User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 10 h 42 m 46 sec
Reputation Power: 780
The preserveData attribute will allow for this sort of thing but it will mean altering the the idiom you are using to handle the form (it must post back to the same page).

Real HTML forms also vary in how this works, and it varies from browser to browser as well. If it is really a major issue that if the user presses back that the form keeps the values they entered then you may need to handle it with session variables or something similar (just as you would with an HTML form). If you really want to do it I would look at session variables instead of cookies.

Reply With Quote
  #5  
Old April 11th, 2006, 11:50 AM
Attackmaster Attackmaster is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 1 Attackmaster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 25 sec
Reputation Power: 0
Huge Problem

I have heard a few solutions: set the timeout to a high number but anything over 2 minutes seems to be ignored. Is there a real solution for the Back button Error in cfform Flash type. I dont want the form to expire until the browser is closed. Is there a server setting, cache setting? I have tried META tags to no-cache and a few other things like check for a cookie. Non of these are real solutions. Any other ideas. Thanks

George

Reply With Quote
  #6  
Old April 13th, 2006, 04:16 AM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 844 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 23 h 59 m 58 sec
Reputation Power: 57
Send a message via MSN to Panther893
maybe use sessions to store submitted data or maybe cookies??? that way you can atleast get it to save untill the browser closes?
__________________
MostarDesigns.com

Reply With Quote
  #7  
Old June 27th, 2007, 11:34 AM
btroop202 btroop202 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 1 btroop202 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 41 sec
Reputation Power: 0
Quote:
Originally Posted by Alas
As those who've started using CF 7 noticed when you use a flash form and the user hits back on the browser it makes a nasty little message that says "the form data has expired please refresh page" this looks super unproffessional.

Heres how to fix it.

Code:
<script language="javascript">

function refreshPage()
{
if(getCookie("refresh") == null)
{
window.location.reload(true);
setCookie("refresh", "refreshed");
}
else
{
setCookie("refresh", "");
}
}

function setCookie(name, value, expires, path, domain, secure) {
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}

function getCookie(name) {
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1) {
begin = dc.indexOf(prefix);
if (begin != 0) return null;
} else
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}

</script>


Put this puppy in your <head> tag and your good to go.

-Alas

PS i just wasted 4 hours on this same problem ...i hope i saved somebody some time



where do I put the call for this? and how would I do it when there are form variables?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Error when user hits back-CF 7 flash forms


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT