I beg for a solution!

Hi, i am facing a problem… pls help me with a solution… am more than appreciate thank you…

i have a richtext field, and that field is mandatory… when attachment is put in the field… it cannot be submit… cos only when text is entered in the field then can submit… i check the field by doing this…

If uidoc.FieldGetText(“attachment”) = “” Then

Msgbox “Please add your attachment”, 64, “Error”

Call uidoc.GotoField(“attachment”)

checkFields = 1

Exit Function

End If

this ‘attachment’ field is a rich test field…

pls help me with a solution… thank you very much :slight_smile:

Subject: i beg for a solution!!!

So you want it that only text can be entered, and no attachments? Why not use a richtext lite?

Martin Vereecken

http://www.bizzybee.be

Subject: Validate Richtext Function

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