Examples: OnSubmit event
- This OnSubmit event discontinues the save operation and moves
the insertion point to the Title field if the Title field is empty.
Sub Onsubmit(Source As Notesuidocument, _
Continue As Variant)
If Source.FieldGetText("Title") = "" Then
Messagebox "You must enter a title",, "No title"
Call Source.GotoField("Title")
Continue = False
End If
End Sub
- This OnSubmit event updates the ProjectStatus field depending
on the difference between the current date and the date in the DueDate
field.
Sub Onsubmit(Source As Notesuidocument, _
Continue As Variant)
Dim todayDT As NotesDateTime
Dim dueDT As NotesDateTime
Dim daysLeft As Long
Dim status As String
Call Source.Refresh
Set todayDT = New NotesDateTime("Today")
Set dueDT = New NotesDateTime _
(Source.FieldGetText("DueDate"))
daysLeft = dueDT.TimeDifference(todayDT) / 86400
Select Case daysLeft
Case 1, 2, 3
status = "Urgent"
Case 4, 5, 6
status = "Hurry up"
Case Else
status = "No worries"
End Select
Call Source.FieldSetText("ProjectStatus", status)
End Sub
Have feedback?
Google Analytics is used to store comments and ratings. To provide a comment or rating for a topic, click Accept All Cookies or Allow All in Cookie Preferences in the footer of this page.