Validating Entry Of A Rich Text Field

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.

View member feedback to this tip.

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


Call uidoc.ExpandAllSections
'This is only needed if your field is in a section that may be closed when this
executes

Call uidoc.GotoField(rtfield)
Call uidoc.SelectAll

'The next line will generate a 4407 error message if the Rich Text Field is
null

Call uidoc.DeselectAll

IsRTFNull = False

Exit Function


Errhandle:
Select Case Err
Case 4407
'the DeselectAll line generated an error message, indicating that the rich
text field does not contain anything
If currentfield <> "" Then
Call uidoc.GotoField(currentfield)
End If
IsRTFNull = True
Exit Function
Case Else
'For any other error, force the same error to cause LotusScript to do the
error handling
Error Err
End Select
End Function


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.

—Girlie B.


Do you have comments of your own? Let us know.

This was first published in November 2000

Dig deeper on LotusScript

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close