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

SearchWindowsServer

Search400

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury

SearchDataCenter

SearchContentManagement

Close