I’ve been struggling with this problem all week. I have an application designed for the web. My $$ViewTemplateDefault contains an embedded view. The view is an HTML view. Several fields are wrapped in input tags so the users can change values from the view without opening the document. There is some onChange code that kicks off an agent to save the document when a field changes. This is the code:
function saveRecord(docNumber) {
var form = window.document.forms[0];
var server = form.Server_Name.value;
var dbpath = form.webDB.value;
var docID = eval('document.forms[0].Docunid_' + docNumber + '.value');
var A1 = eval('document.forms[0].A1_' + docNumber + '.value');
var A2 = eval('document.forms[0].A2_' + docNumber + '.value');
var A3 = eval('document.forms[0].A3_' + docNumber + '.value');
var A4 = eval('document.forms[0].A4_' + docNumber + '.value');
var agentPath = “//” + server +“/” + dbpath + “/saveDoc?openagent&unid=” + docID + “&A1=” + A1 + “&A2=” + A2 + “&A3=” + A3 + “&A4=” + A4;
document.getElementById(“agentOutput”).src = agentPath;
}
Then the agent, just finds that doc and saves it. Works great while the user is logged in. The problem is that when the session times out, the user doesn’t know about it. The onChange code will still kick off, but the save agent won’t because the user is not logged in. I struggled for a while to get the save agent to refresh the parent page (thus displaying the login screen), however, I think that isn’t working because I’m logged out - the agent won’t even run of course, so I can’t write the javascript to do the reload if I’m not logged in. Makes sense, right?
So, I think I may need some sort of check in the onChange event to see if the user is still logged in and if not, pop up the login screen. Does anyone know how I could go about this? Or is there some other way to detect the timed out session and alert the user?
Right now, my agent output is directed to a hidden iframe. I could unhide it and if the user knew what to look for, they would see the login screen in the iframe if they were logged out, but it seems like there must be a better way. Any ideas are appreciated.