For a web application I am using the address book function taken from one of the standard templates. Once people have been selected and the OK button clicked it populates a names field on the underlying document. This in turn fires off a function that looks up their personal details in another database and populates other fields on the document with the details.
The lookups may take between 5 - 30 seconds to do depending on the users connection to the server so I am displaying a message on the document to inform them that the look up is in progress.
JSheader
var addresswindow; //handle on address book window
Address book button
var pathname = (window.location.pathname);
document.forms[0].NamesRequireAccess.focus();
addresswindow = window.open(pathname.substring(0,(pathname.lastIndexOf(‘.nsf’)+5))+‘wAddress?OpenForm’
,‘Address’,‘status=yes,resizable=yes,scrollbars=yes,screenX=0,screenY=0,width=630,height=480’);
The last line of code in the OK button on the address book form sets the focus to another field on the underlying document to ensure that the field NamesRequireAccess onblur function runs.
NamesRequireAccess onblur event
addresswindow.close();
var targetDiv = document.getElementById(‘updateUser’);
targetDiv.innerHTML = “Looking up details from Staff Portal. Please wait”;
//alert(“blurring”);
HasAttendedSeminar();
GetPortalDetails();
The problem is that the functions HasAttendedSeminar(); and
GetPortalDetails(); are running before the address window is closed and the message displayed to the user. However if I run it with the alert box then it works in the correct order but defeats the object of what I am trying to do.
Any ideas appreciated