XPAGES - working with rich text fields - any solution?

Hello everybody,I m looking for a solution to work with a rich text field in an XPAGE.

Here is my problem : my customer is not satisfied with Domino / Dojo editor. We integrated tiny mce. In the form, we have a simple “Body” rich text field. tiny mce stands on a xp:inputTextarea, which is bound to the Body field.

example xpage code to reproduce our problem is hereafter.

Now, here is what we can observe :

1/text area content is well saved, but Body field is either saved as a text field, or as a list of text field

2/ if amount of content is too large for a text field, we loose everything. Body field is saved as text and contains “”. OUCH!!!

Now, i wanted a rich text field, and i had my reasons… is there a way to bind a textarea to a rich text field and to have it saved as such?

Thanks in advance.

the xpage code to reproduce the problem :

<?xml version="1.0" encoding="UTF-8"?>

<xp:view xmlns:xp=“http://www.ibm.com/xsp/core”>

<xp:this.data>

	<xp:dominoDocument var="document" scope="request"

		formName="document">

	</xp:dominoDocument>

</xp:this.data>

<xp:inputTextarea id="EditBodyField"

	style="width: 645px;height:600px;" disableTheme="true"

	value="#{document.Body}">

</xp:inputTextarea>

<xp:br></xp:br>

<xp:button value="Save" id="btnSave">

	<xp:eventHandler event="onclick" submit="true" refreshMode="complete">

		<xp:this.action>

			<xp:actionGroup>

				<xp:save name="/SaveRichText.xsp"></xp:save>

			</xp:actionGroup>

		</xp:this.action>

	</xp:eventHandler>

</xp:button>

</xp:view>

Subject: A step further

To go a step further about our rich text problem, here is what i tried to do, as a workaround :- before save, in jss, grab content of text area

  • after save, remove body field

  • create a new rich text body field

  • paste content of text area previously saved in newly created body field

i tried to replace the save button code, in my xpage, with the following :

				<xp:executeScript>

					<xp:this.script><![CDATA[#{javascript:	

						var vHTMLCode = "[";

						for (i = 0;i<document.getItemValue("Body").size();i++) {

							vHTMLCode += document.getItemValue("Body").elementAt(i);

						}

						vHTMLCode += "]";

						document.getDocument().removeItem("Body");

						

						// Save here

						document.save();

						

						var vRTItem:NotesRichTextItem = document.getDocument().createRichTextItem("Body");

						vRTItem.appendText(vHTMLCode);

						document.getDocument().save();

					}]]></xp:this.script>

				</xp:executeScript>

i dont manage to get it to work. I get an error on appendText, saying i m trying to append on a NotesItem, and not a NotesRichTextItem.

I really need to find a solution to be able to manage large amount of text in a text area, and to get it saved correctly.

Any hint would be really nice.

Thanks.

Luc

Subject: Found a workaround

Hi Luc, partly because of your work I found a workaround for this. See CKEditor integration with XPages (32k limited) | DontPanic - a blog about Lotus Notes / Domino.