This function can be used to validate that the user has put something in a Rich Text Field. This is very useful on a form that has RTF that are required entry fields. Call this function from your validation routine to determine if your RTF is empty.
Function IsRTFNull(rtfield As String) As Integer
'This function tests a Rich Text field to see whether or not it is null. It
returns TRUE if 'the field is null, and returns FALSE if the field is not
null. It works even if the rich 'text field contains a file attachment,
doclink, or OLE object but does not contain any 'text.
On Error Goto Errhandle
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
'This is only needed if your field is in a section that may be closed when this
'The next line will generate a 4407 error message if the Rich Text Field is
IsRTFNull = False
Select Case Err
'the DeselectAll line generated an error message, indicating that the rich
text field does not contain anything
If currentfield <> "" Then
IsRTFNull = True
'For any other error, force the same error to cause LotusScript to do the
MEMBER FEEDBACK TO THIS TIP
I would like to know what should be the Error code (other than 4407) if I wanted to check the RichTextField if it has DocLink only. I wanted the RichTextField to be filled with DocLink only.
Do you have comments of your own? Let us know.
This was first published in November 2000