I have a form with a Save & Submit button which calls an agent and closes and saves the form. Some users click “X” to close the document and then click yes when asked if they want to save it, but this does not call the agent.
Is it possible to disable the “X” at the top of a form or does anybody have a way around this issue?
Subject: Disable clicking X to close a document
Hi …
create a computed SaveOptions field and set its default value as “0” … Then it won’t ask for do you want to save form …
& in agent first set the value of SaveOptions as “1” and then save the document …
Subject: RE: Disable clicking X to close a document
The SaveOptions choice is probably a small piece of what you are looking for- While it won’t be saved- it also is not very helpful to the end user- In global declarations- I do this
Dim ws As NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim AllowExit As Boolean 'disallow users from pressing ESC to save
then in QuerySave
Sub Querysave(Source As Notesuidocument, Continue As Variant)
If Not AllowExit Then
Msgbox "Sorry, you cannot press ESC to leave this document or Ctrl-S to save it. Use the buttons instead.", 16, "No Escape"
Continue = False
Exit Sub
End If
’ **** Do all field validation in OKToSave function called from Actions ****
End Sub
Then in a function in globals- I write the code for “AllowExit” to validate field formulas, run other code, and set the value of “okaytosave” to true.
Subject: RE: Disable clicking X to close a document
-oh, and in QueryOpen, I set the value AllowExit = False
Subject: Disable clicking X to close a document
I like Thomas’ response but the other option is to consider moving your code out of the button and determine if they can be added to the QuerySave, PostSave or QueryClose events.
That way if the user closes the form other than using your button the save code gets run ALWAYS.