is there a way to validate an RTF field if that is empty or not and take an action?

148 Views Asked by At

I have a form that should not be saved, so once the user receive it in their Inbox like an email, they need to respond at that time. There are two other checkbox fields rv1 and rv2 that will bring an information with choice Yes (rv1) or No (rv2). I tried to perform validation using an RTF field called "Comments", because the user can include attachments or a text formatted to the field, but that never worked. So what I did was create a text only field called "cmt" that get the value from the RFT and check if the RTF is empty or not via this field. It worked for checkbox value Yes, but when the user choose the checkbox value No, it is mandatory to include a response to that field comments, and once the user choose No, the message continually shows up and even though the user click Ok and try to click the field "Comments", the message keep showing and do not allow the user to do anything else. I appreciate any help, thanks.

Here is the code: Sub Querysend(Source As Notesuidocument, Continue As Variant)

Dim rv2 As String

Dim cmt As String
Dim reason As String

reason = "You selected No. Please enter a comment."

rv2 = Source.Document.rv2(0)

If rv2 = "No" Then
    
    cmt = Trim(Source.FieldGetText("cmt" ))
    
    If(cmt = "") Then
        
        Messagebox reason, 5, "Error"
        
        continue = False
        Exit Sub        
    End If
    
End If

End Sub

0

There are 0 best solutions below