Domino Code Fragment
Code Name* Validating a date field while allowing no date to be entered. | Date* 04/29/2024 | Source (or email address if you prefer)* Rlatulippe@romac.com IP address:.18.217.220.114 | |
Description* This was used to validate a date field, several date fields were used in sequence and it was not required that they be filled at time of document compose. However this allowed the date field to be saved and prevented the default error message! | Type* Formula | Categories* (Misc) |
Implementation: | Required Client: | Server: |
Limitations: | Comments: This was used because the entering and exiting scripts checked the field for changes and wrote to other fields on change: see below code as the example. (Declarations) Dim DateV As String Sub Entering(Source As Field) On Error Goto Errhandle Dim ws As New NotesUIWorkspace Dim uidoc As NotesUIDocument Set uidoc = ws.currentdocument Dim doc As NotesDocument Set doc = uidoc.document Dim item As NotesItem Set item = doc.GetFirstItem( "BPSigned" ) DateV = Cstr(item.values(0)) ErrHandle: Exit Sub End Sub Sub Exiting(Source As Field) On Error Goto Errhandle Dim Session As New NotesSession Dim ws As New NotesUIWorkspace Dim uidoc As NotesUIDocument Set uidoc = ws.currentdocument Dim doc As NotesDocument Set doc = uidoc.document Dim item As NotesItem Set item = doc.GetFirstItem( "BPSigned" ) Dim DateM As String DateM = Cstr(item.values(0)) Dim userName As New NotesName(session.UserName) If DateM <>DateV Then doc.ModifiedOn = Date$ doc.UpdateFour = userName.Common doc.BPStatus = "Signed" End If ErrHandle: Exit Sub End Sub |