Subject: help needed on window.close() started from LotusScript
Okay. I had a very similar problem to you just today which I managed to resolve so I hope this helps you.
What I was doing was opening a dialog window from a parent document using JS window.open, then populating fields in the dialog window and then clicking a button which validated the form and then saved it and closed the window, hence returning the user to the parent document.
What you need to do is write a JS validation routine to perform your validation, don’t use Lotus Script. Put this function in the JS Header of your dialog form. For example:
frm = document.forms[0];
function doValidate(){
if(frm.FieldName.value==""){
alert("Please enter a value into field");
return false;
};
//return true if there are no validation erros.
return true;
};
Once you’ve done, you can call it by putting a done or submit button on the form with the following code.
frm = document.forms[0];
if(doValidate() == true){
//This is the command to do a FileSave, FileCloseWindow
frm.submit();
};
Now this is where I had problems. If you put window.close(); after the frm.submit() call (above) you will find that the form won’t save. I think this is becuase IE or rather the JS interpeter doesn’t wait for the frm.submit() to complete - it continues on with the window.close(); function. I think this was what Matt was saying in another post…
What I had to do is create a new form, completely blank. Call it something like… “Window Close Event” with an alias of “frmCloseEvent” for instance. Now in this form’s JS onload event put the JS code window.close();
Now back to your dialog window, create a $$Return field, make it computed and hidden from the web. Now you need to enter this code.
DBPath:=@ReplaceSubstring(@Subset(@DbName; -1); " " : “\”; “+” : “/”);
“[”+DBPath+“/frmCloseEvent?OpenForm]”
To explain this process step-by-step;
-
You click a button on the parent document, which opens your dialog window.
-
Enter the relavent information into dialog
-
Click the submit/done button
-
The JS Validation code is triggered
-
If it is passed the form is saved
-
The $$Return field opens the frmCloseEvent form
-
When the frmCloseEvent form is opened the onload javascript event is triggered which closes the window.
That’s it. Sorry it’s a bit verbose but I like to make sure I get everything down so you understand the fist time around!!! 
I hope this helps you resolve your problem. This solution actually prove’s that it is possible to make a web dialog window close automatically, Matt said that it was not possible… and I would have agreed with him until about an hour ago!
Cheers,
Andrew