Subject: RE: Editmode and richtext field
Hello Benoit,
I think I found the problem, when I add something in the richtext field, an action button that it use to save the form has a condition: if the richtext field is not empty a copy of that field is made to an other one. The script looks like this:
Sub Initialize
Dim w As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim curdoc As NotesDocument
Dim rtitemA As Variant
Dim rtitemB As Variant
Set uidoc = w.CurrentDocument
Set curdoc = uidoc.Document
Call curdoc.ReplaceItemValue("pjtenr","0")
Call uidoc.Save
Set rtitemA = curdoc.GetFirstItem( "pjt_1" )
Set rtitemB = curdoc.GetFirstItem( "pjt" )
Call curdoc.ReplaceItemValue ("pjt_1", "")
Call rtitemA.AppendRTItem( rtitemB )
curdoc.SaveOptions = "0"
Call curdoc.Save(False, True)
REM 'Call w.ViewRefresh
End Sub
(I’m very new to LS, so I have a hard time to understand the backend and UI things)
I realise that curdoc.SaveOptions = “0” could be the problem. But the script works great (to make the copy of the richtext field in an other one).
I think what I need to do is to reload the document and then put curdoc.SaveOptions = “1” so it will save the document without loosing the copy of the richtext field.
My querysave look like this:
Sub Querysave(Source As Notesuidocument, Continue As Variant)
If Source.FieldGetText("savflag") = "1" Then
continue = True
Else
Messagebox "Vous devez utiliser le bouton Enregistrer pour sauvegarder cette demande.",MB_OK,"Erreur"
continue = False
End If
End Sub
and my postsave: (writing a transaction log)
Sub Postsave(Source As Notesuidocument)
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
doc.Form = "MQE_0004"
doc.seqdmd_log = Source.FieldGetText("seqdmd")
doc.stt_log = Source.FieldGetText("stt")
doc.dtecrt_log = Source.FieldGetText("dtecrt")
doc.usrcrt_log = Source.FieldGetText("usrcrt")
doc.act_log = Source.FieldGetText("act")
Call doc.Save(True, False)
End Sub
Thanks for your help!