There is nothing more frustrating than taking 30 minutes filling out some text in a long form only to submit and have your session reset and lose all of your data. Here is a simple solution to keep a session open on forms where users may need an extended period of time for data entry. I included this code on any page where I need the session extended. You can remove the javascript include if JQuery is included on everyone of your pages already.
<!--- Include this file on any page where users may take a
long time filling in text and you want to keep the session open --->
<cfparam name="variables.refreshrate" default="60000">
<cfoutput>
<script type="text/javascript" src="/js/jquery-1.3.2.min.js"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
setTimeout("callserver()",#variables.refreshrate#);
});
function callserver()
{
var remoteURL = '/emptypage.cfm ';
$.get(remoteURL, function(data){
//alert(data);
setTimeout("callserver()",#variables.refreshrate#);
});
}
</script>
</cfoutput>
I ran across this today. Examples are great when trying to understand JQuery selectors.