I wonder why the code below is not working. The only change I made was to rename “rtfield” to the richtext field on my form, “LinkField”. I keep getting a “Type mismatch in method AssignClassIntance…error…”, then it saves and closes the document. I got the code from here,
Our third method validates a rich text field in which an input consisting solely of an attachment, embedded object, or link is allowed, even if it includes no accompanying text. Once again, we use the Querysave event of the form containing the field:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
Dim rtitem As NotesRichTextItem
Set doc = Source.Document
Set rtitem = doc.GetFirstItem( "rtfield" )
Dim text As String
text$ = Source.FieldGetText("rtfield")
trimmed$ = Trim(text)
If(doc.Hasembedded) Then
Continue = True
Elseif ( trimmed$ = "") Then
Msgbox "Please enter some text."
Continue = False
source.GotoField("rtfield")
source.Refresh(True)
Else
Continue = True
End If
Subject: Code from IBM site for rt validation not working correctly?
First of all, show your code.Second, run the code in the debugger and tell us what line the error happens on, and what the value is for all relevant variables/objects.
Also, unless your validation involves the presence of attachments, you don’t need all that code.
Why don’t you describe what kind of validation you are trying to do, it will be much easier to come up with a solution then.
The IBM page you link to also says: “We assume that you have some experience developing applications using Domino Designer and LotusScript.”
You should never copy/paste code you don’t understand what it is doing.
Subject: RE: Code from IBM site for rt validation not working correctly?
You should explain in your initial (first) message what it is you are trying to do. It does not help us just becaus eYOU know what you are trying to do.
Subject: RE: Code from IBM site for rt validation not working correctly?
Rich point very well taken. Will do. Karl you come across as rude and being insulting. I don’t need your lecture. The questions are never clear to you. That’s fine. Please when you see my posts just skip them.
Subject: RE: Code from IBM site for rt validation not working correctly?
Karl is trying to help you. If you follow his advice, it’s much easier for others to help you. You have people here who are helping others for no gain, purely out of good will.