Ask the Expert

Checking for user entries in a rich text field

I have a rich text field where I'd like to make sure the user enters SOMETHING - ie text, an attachment, a picture - basically anything.

I know I can check Source.FieldGetText("FieldName") in the querySave of the form to check if there's text - and there are ways to check for attachments as well - but what if there's no text, and no attachment - what if there's only a picture (created with Create-Picture)? Any way to check for that?
You can check for it using the -EmbeddedObjects- Property in -NotesRichTextItem-. This property will return any embedded objects in the -NotesRichTextItem- you specify as an array. you can then check subordinate properties of those items individually if you need to by using -GetEmbeddedObject- and assigning the return to a -NotesEmbeddedObject- Object. Hope this helps.

By the way, this method also finds file attachments, so you could do a quick check for everything you need by verifying that RTItem.EmbeddedObjects does NOT return a null array AND RTItem.GetFormattedText is NOT the null string. These two lines would I believe satisfy your validation.

This was first published in February 2001