1
votes

I am developing an xpages application and use 1 custom control where I have a rich text field on it. The source document is on the main page. The rich text field has it value via compositeData. I pass the document and the field name. In the CC I address the rich text field as compositeData.DataSource[compositeData.Fieldname] Where DataSource my document1 is and Fieldname the name of the rich text field on the notes document.

All works except inserting an image in the rich text and removing attachments.

I did find a lot of information about this but not a real solution. Dit anybody ever found a solution for this?

Regards,

Peter

Here is the code:

Custom Control

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xe="http://www.ibm.com/xsp/coreex">
    <xp:panel>
        <xp:label id="label1" value="Title:"></xp:label>
        <xp:inputText id="inputText1">
            <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Title]}]]></xp:this.value>
        </xp:inputText>
        <xp:br></xp:br>

        <xp:inputRichText id="richtext">
        <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Field]}]]></xp:this.value></xp:inputRichText>
        <xp:fileUpload id="fileUpload1">
            <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Field]}]]></xp:this.value>
        </xp:fileUpload>

        <xp:fileDownload rows="30" id="fileDownload1"
            displayLastModified="false" allowDelete="true">
            <xp:this.value><![CDATA[#{compositeData.DataSource[compositeData.Field]}]]></xp:this.value>
        </xp:fileDownload>

    </xp:panel>

</xp:view>

XPAGE using the CC

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom"
    xmlns:xe="http://www.ibm.com/xsp/coreex">

    <xp:this.data>
        <xp:dominoDocument var="document1" formName="testform"></xp:dominoDocument>
    </xp:this.data>
    <xe:applicationLayout id="applicationLayout1">
        <xp:panel>
            <xp:button id="button1">
                <xp:this.value><![CDATA[Save & Close]]></xp:this.value>
                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="complete">
                    <xp:this.action>
                        <xp:actionGroup>
                            <xp:saveDocument var="document1"></xp:saveDocument>
                            <xp:openPage name="$$PreviousPage"></xp:openPage>
                        </xp:actionGroup>
                    </xp:this.action>
                </xp:eventHandler>
            </xp:button>
            <xp:br></xp:br>
            <xc:cc DataSource="#{javascript:document1}" Field="Body" Title="Title">
            </xc:cc>
        </xp:panel>
        <xe:this.configuration>
            <xe:bootstrapResponsiveConfiguration></xe:bootstrapResponsiveConfiguration>
        </xe:this.configuration>
    </xe:applicationLayout>

    <xp:this.navigationRules>
        <xp:navigationRule outcome="xsp-success" viewId="$$PreviousPage"></xp:navigationRule>
    </xp:this.navigationRules>
</xp:view>
1
Please add a code example. I have this working and will find an example for you tomorrowPer Henrik Lausten

1 Answers

0
votes

I use the following in a custom control. Notice that I use a different syntax for the value parameter for xp:inputRichText than for the upload and download controls - and that the value parameter is computed on page load ($) instead of dynamically (#):

    <xp:inputRichText id="richtext" value="${javascript:'#{document.' + compositeData.fieldName + '}';}"></xp:inputRichText>

    <xp:fileUpload id="fileUpload" value="#{document[compositeData.fieldName]}"></xp:fileUpload>

    <xp:fileDownload id="fileDownload" value="#{document[compositeData.fieldName]}"></xp:fileDownload>