Manage Learn to apply best practices and optimize your operations.

LotusScript Form Validation Code

This code will validate the specified fields and return a single message box listing all the fields that do not meet the validation requirements. This works great in form submit buttons where other code needs to be executed that can't normally be done using formula language.

Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim msg As String

Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document

'Replace FieldNameX with your field names.

msg = ""

If doc.FieldName1(0) = "" Then
msg = "Text description of FieldName1" & Chr(13)
End If

If doc.FieldName2(0) = "" Then
msg = msg & "Text description of FieldName2" & Chr(13)
End If

If doc.FieldName3(0) = "" Then
msg = msg & "Text description of FieldName3" & Chr(13)
End If

'Continue for for all fields that require validation.

If msg <> "" Then
MsgBox msg,0+64,"The following fields were left blank or contain incorrect values..."
Exit Sub
End If

'Enter more code here if needed.

Call doc.Save(True,True)
Call uidoc.Save
Call uidoc.Close

Dig Deeper on Domino Resources



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...