RE: How to validate a richtext field Betsy Thiede 18.Oct.10 09:56 AM a Web browser Applications Development 7.0.1Windows XP
Function validatert(doc ,uidoc,bodystr) As Boolean
Dim hasInfo As String
Dim i As Integer
Dim rtnav As NotesRichTextNavigator
Dim elemType(1 To 8) As Long
Dim tempDoc As NotesDocument
Call uidoc.refresh(True)
Set doc = uidoc.document
Set body = doc.GetFirstItem(bodystr)
If body Is Nothing Then
validatert = False
Exit Function
End If
Set rtnav = body.CreateNavigator
Dim rtrange As NotesRichTextRange
Set rtrange = body.CreateRange
elemType(1) = RTELEM_TYPE_DOCLINK
elemType(2) = RTELEM_TYPE_FILEATTACHMENT
elemType(3) = RTELEM_TYPE_OLE
elemType(4) = RTELEM_TYPE_SECTION
elemType(5) = RTELEM_TYPE_TABLE
elemType(6) = RTELEM_TYPE_TABLECELL
elemType(7) = RTELEM_TYPE_TEXTPARAGRAPH
elemType(8) = RTELEM_TYPE_TEXTRUN
For i = 1 To 8 Step 1
If rtnav.FindFirstElement(elemType(i)) Then
hasinfo = "Yes"
Exit For
Else
hasinfo = "No"
End If
Next
If hasinfo = "No" Then
validatert = False
Exit Function
Else
validatert = True
End If
End Function