|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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 ![]() |
|
#2
|
|||
|
|||
|
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! ![]()
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums Last edited by kiteless : March 14th, 2005 at 09:28 AM. |
|
#3
|
||||
|
||||
|
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? |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
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 |
|
#7
|
|||
|
|||
|
Quote:
where do I put the call for this? and how would I do it when there are form variables? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Error when user hits back-CF 7 flash forms |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|