[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

Dialogbox Custom close

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"
     ws.currentDocument.close

The QueryClose code is:
     If Source.document.tempValueAllowClose(0) <> "1" Then
          Continue = False
          Beep
          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
0
schmad01
Asked:
schmad01
  • 3
  • 2
1 Solution
 
Sjef BosmanGroupware ConsultantCommented:
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
 
0
 
schmad01Author Commented:
Ok, that will work. Can you also tell me how I would add a title to the Messagebox?  I'm not a script guru.
0
 
Sjef BosmanGroupware ConsultantCommented:
Messagebox "message", 16, "title"

For the 16, you can take other icon numbers (should include "lsconst.lss", but I'm often too lazy :$)
0
 
Sjef BosmanGroupware ConsultantCommented:
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
0
 
schmad01Author Commented:
Thank you very much.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now