- Set your Rich Text field to "Store contents as HTML and MIME".
- Bind your Rich Text control to a scoped variable (requestScope.Body).
- AddSSJS to afterPageLoad event.
- var entity:NotesMIMEEntity = document1.getDocument().getMIMEEntity("Body");
- if (entity != null) {
- requestScope.Body = entity.getContentAsText();
- }
Then in your querySaveDocument you can call a function similar to the one below:
function updateBody( doc:NotesDocument ){
if (requestScope.Body != null) {
//requestScope.body is bound to an inputRichText control
var body:com.ibm.xsp.http.MimeMultipart = requestScope.Body;
var stream:NotesStream = session.createStream();
stream.writeText(body.getHTML());
var entity:NotesMIMEEntity = doc.getMIMEEntity("Body");
entity.setContentFromText(stream,"text/html;charset=US-ASCII", 1725);
stream.close();
} else {
requestScope.status = "no content";
}
}