Hi all,
I have the following class in LotusScript:
Option Public
Option Declare
Const FIELD_PRESAVEEXPDATE$ = “PreSaveExpDate”
Const RESET_REPORT% = 0
Class DateChecker
m_doc As NotesDocument
m_expDT As NotesDateTime
m_preSaveExpDT As NotesDateTime
Public Sub New(Source As NotesUIDocument)
On Event OnLoad From Source Call GetCurrentDate
On Event OnSubmit From Source Call CheckExpDate
End Sub
Public Sub GetCurrentDate(Source As NotesUIDocument)
Set m_doc = Source.Document
Set m_expDT = New NotesDateTime(m_doc.SExpDate(0))
m_doc.PreSaveExpDate = m_expDT.DateOnly
End Sub
Public Sub CheckExpDate(Source As NotesUIDocument,Continue As Variant)
Set m_doc = Source.Document
Set m_expDT = New NotesDateTime(m_doc.SExpDate(0))
Set m_preSaveExpDT = New NotesDateTime(m_doc.PreSaveExpDate(0))
If m_expDT.DateOnly = m_preSaveExpDT.DateOnly Then
Continue = True
Else
m_doc.RemoveItem(FIELD_PRESAVEEXPDATE)
m_doc.ReportRun = RESET_REPORT
Continue = True
End If
End Sub
End Class
In my OnLoad event, I have the following code:
Sub Onload(Source As Notesuidocument)
Dim dateChecker As New DateChecker(Source)
End Sub
When the Onload event runs, it instantiates the class, but ignores my On Event line.
Am I doing this right? Or am I missing something? Any enlightenment would be greatly appreciated.
brandt