RichTest Field validation

Hello,

How can I validate in a Form if a RichText field is not empty?

The idea is, if this field is empty, then user cannot save and close a Form.

Thanks in advance!

Leo

Subject: RichTest Field validation

dim ws as New NotesUiWorkspacedim uidoc as NotesUiDocument

dim doc as NotesDocument

set uidoc = ws.CurrentDocument

set doc = uidoc.Document

if Trim(doc.Body(0)) = “” then

msgbox “Field is empty”

end if

(assuming that “Body” is the name of ur Rich Text field)

hope this helps!!

Subject: I would love to know how you got this working

This line produces an error if Body is a RTF because Body is an RTF - Variant does not contain a container.if Trim(doc.Body(0)) = “” then

Subject: RE: RichTest Field validation

Thanks a lot!

Where should I enter this script?

Now it’s in QuerySave and I’m getting an error like: “Variable does not contain an object”

:frowning:

Subject: RE: RichTest Field validation

whats the name of your Rich Text field?

you could put the following code in your querysave event :

If source.fieldgettext(“Body”) = “” Then

continue = False

Msgbox "Field Empty"

Exit Sub

End If

make sure you change the field name as per yours.