Need help with javascript to keep session active

I have a web application that has a rather lengthy form and it takes users some time to fill it out. If it takes too long, the session times out (the 30 minute server session timeout as set in the server document) and when they submit it, since the session has timed out, all their work is lost. (They have a 'save as draft, but not everyone thinks to use it.) I’ve done some poking around and thought I found a solution that would work for me. It’s just some javascript code that will keep the session open. Every 20 minutes I want it to access something on the server - just enough to keep the session alive. I tried using the prototype.js library and could not get it to work, so I decided to go with setInterval in javascript since it seemed pretty simple, but I can’t get it to work.

In the jsHeader of my form I have this function:

function KeepSessionAlive ( ) {

var now = new Date();

foo = new Image();

var newurl = '/Test/TestFinDisc.nsf/frmFinQ?OpenForm&time='+now.toGMTString();

foo.src = newurl;

}

(I also tried a ?time= rather than &time= and tried accessing a jpg image resource rather than a form)

And I have this as passthrough HTML on my form to call the function every 20 minutes (1 minute for testing purposes)

The function itself seems to work - I can call it from a hotspot and see in the domlog.nsf that the url is being hit. However, it isn’t being called from the form like it should.

I don’t have much experience with javascript so I’m sure I’m missing something obvious. Any help is appreciated!

Subject: Need help with javascript to keep session active

Approach is good but with server limitations…rather I would suggest

  1. Breakdown form based on business requirements (first thing first…like wizards)

  2. Lotus Notes 7 come up with autosave functionality…use the same approach…say at the interval of 5 min save the document internally and if session expires, present user the data he/she filled till time. If they submit before session expire then while saving delete internal document.

Hope these approaches will help you…