Search code examples
xpagesxpages-ssjs

XPages: Rich Text Fields have summary to true when saved. Why and how to set the flag to false?


I have a document that was created using a copyallitems. That document has 2 body fields, and they both have the issummary flag to false.

As soon as I do a document1.save(), both rich text fields now have the flag set to true.

Any idea why the flag would be set to true by saving the document? These fields are not used in any views. I thought that rich text fields were not suppose get the summary flagged when saved.

Both rich text fields are set to store content as MIME...

Any clues on how to avoid the flag from being set, or how to remove the flag before saving (or after, or whatever) the document?

Running on Domino Release 9.0.1FP3 HF241

Here is sample code that recreates the problem, when adding more than 32Kb od text in the rich text field:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"><xp:span style="font-weight:bold"></xp:span>
    <xp:label id="label1" styleClass="h1" value="Test Issummary"></xp:label>
    <xp:span style="font-weight:bold"></xp:span>
  <xp:this.data>
    <xp:dominoDocument computeWithForm="onsave" formName="fPage" var="document1"/>
  </xp:this.data>
  <xp:br></xp:br>
  <xp:br></xp:br>
  Subject:
  &#160;
  <xp:inputText id="inputText1" value="#{document1.Subject}"
    style="width:569.0px">
  </xp:inputText>

  <xp:br></xp:br>Status:&#160;
  &#160;
  <xp:inputText id="inputText2" defaultValue="Draft" value="#{document1.Status}"></xp:inputText>

  <xp:br></xp:br>
  <xp:br></xp:br>Body:<xp:br></xp:br>


    <xp:inputRichText id="inputRichText1" style="width:100%"
        value="#{document1.Body}" htmlConversionWarning="noWarning"
        htmlFilter="identity" htmlFilterIn="identity">
    </xp:inputRichText>
    <xp:br></xp:br>
    <xp:br></xp:br>
    <xp:br></xp:br>
    <xp:button value="Save" id="button1"
        style="width:122.0px;height:29.0px">
    <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
        <xp:this.action>

            <xp:actionGroup>
                <xp:saveDocument var="document1"></xp:saveDocument>
                <xp:openPage name="/adminDrafts.xsp"></xp:openPage>
            </xp:actionGroup>
        </xp:this.action></xp:eventHandler></xp:button>
</xp:view>

Once saved, the document cannot be opened anymore as the infamous 32k error message is displayed.

If I save with less than 32K, the document is ok, but the rich text field has the issummary flag to yes... That is mostly the cause of my problem...


Solution

  • As you are using option computeWithForm make sure your form "fPage" contains your rich text field and is of type rich text. Otherwise it might get converted to a normal text field.

    Use option computeWithForm only if you really need to as it an expensive operation.