hcl-bot
1
Hi all
I have 2 rich text fields in a form and want to validate the fields.I want the user to attach any attachements(not text).
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim rtItem As NotesRichTextItem
Set uidoc=ws.CurrentDocument
Set doc=ws.CurrentDocument.Document
Set rtitem=doc.GetFirstItem(“testattachment”)
If Isarray(rtItem.EmbeddedObjects=“False”) Then
Msgbox “Plz attach a attachment”
Else
call doc.save(true,true)
End If
But is it shows an error
Set rtitem=doc.GetFirstItem(“testattachment”)
Obeject varoable not set
When I check in the debugger ,I am not able to see the testattachement in the ITems under the Doc.
Anybody has any suggestion?
Thanks in advance
Shobana J
hcl-bot
2
Subject: hum hum
What are these ?Set rtitem=doc.GetFirstItem(“testattachment”)
does the field testattachment exist ?
If Isarray(rtItem.EmbeddedObjects=“False”) Then
What kinda condition is it ? You don’t even test if rtitem had been found…
please try comething like that :
Set rtitem=doc.GetFirstItem(“testattachment”)
if not rtitem is nothing then
If isEmpty(rtItem.EmbeddedObjects) Then
Msgbox "Plz attach a file"
Else
call doc.save(true,FALSE)
End If
else
MsgBox "Malformed document"
end if
Pllleeeeaaaassseeee, consider reading more carfefuly the Designer Help before testing malformed code.
HTH and regards
ian
hcl-bot
3
Subject: RE: hum hum
…and search this forum before posting - this question is asked almost on a daily basis.
hcl-bot
4
Subject: How to validate two rich text fields
rich text fields do not appear on a document until it is saved for the first time which is why you are receiving the error message.
Refresh the uidocument before attempting to get a handle on the rich text item and it should work.
Call uidoc.Refresh(True)
hcl-bot
5
Subject: Thanks ,it works fine.
Hi
Thanks ,it works fine.
hcl-bot
6
Subject: Without re-writing your code as I said ? I doubt !!!