Dialogbox Custom close

Posted on 2005-05-06
Last Modified: 2013-12-18
I found this code/answer posted by Qwaletee to set up an Ok button and Queryclose in Dialogbox How would it be modified to make sure that fields are filled in?  May be more than one field:

Set up your own OK button.  The OK button has code as follows:
     Dim ws As New notesUiWorkspace
     ws.currentDocument.document.tempValueAllowClose = "1"

The QueryClose code is:
     If Source.document.tempValueAllowClose(0) <> "1" Then
          Continue = False
          Exit Sub
     End If
     Source.document.tempValueAllowClose = "0"

Use NoOKCancel to call the dialog box.

Now, if the users hit your OK button, it works.  If they hit X, Notes just beeps as them
Question by:schmad01
    LVL 46

    Expert Comment

    by:Sjef Bosman
    Just put your code in the OK-button, like
         Dim ws As New notesUiWorkspace
         Dim doc As NotesDocument

         Set doc= ws.currentDocument.document
         If Not field_1_is_filled_in Then
              Messagebox "You have to fill field 1", 16
              Exit Sub
         End If
         ' etc, tests for other fields
         ' and finally, when all fields are correctly set...
         doc.tempValueAllowClose = "1"
         Call doc.close

    Author Comment

    Ok, that will work. Can you also tell me how I would add a title to the Messagebox?  I'm not a script guru.
    LVL 46

    Expert Comment

    by:Sjef Bosman
    Messagebox "message", 16, "title"

    For the 16, you can take other icon numbers (should include "lsconst.lss", but I'm often too lazy :$)
    LVL 46

    Accepted Solution

    Sorry, not view icon numbers. See the file I mentioned or the Designer Help database for the options. From that database (service!):
    MB_ICONSTOP                    16     Stop sign
    MB_ICONQUESTION           32     Question mark
    MB_ICONEXCLAMATION    48     Exclamation point
    MB_ICONINFORMATION    64     Information

    Author Comment

    Thank you very much.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
    This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now