Xpages 就地表单中的文件上载控件

Xpages 就地表单中的文件上载控件,xpages,Xpages,我试图在xpages中的inplace表单中添加文件上载控件。保存表单时,会创建一个文档,但不会保存在就地表单中选择的附件 有人能告诉我有什么办法吗 下面是ExtionsLibrary演示中的示例代码 <?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" xmlns:xc="

我试图在xpages中的inplace表单中添加文件上载控件。保存表单时,会创建一个文档,但不会保存在就地表单中选择的附件

有人能告诉我有什么办法吗

下面是ExtionsLibrary演示中的示例代码

<?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"
xmlns:xc="http://www.ibm.com/xsp/custom">

<xc:OneUILayout id="cc4cconeuilayout"  navigationPath="/Core/InPlaceForm">
    <xp:this.facets>
        <xp:panel xp:key="LeftColumn" id="panel4">
            <xc:LeftCore id="cc4ccLeftCore" ></xc:LeftCore>
        </xp:panel>
    </xp:this.facets>
    <xp:panel>
        <xp:panel>
            <xp:this.data>
                <xp:dominoView var="view1" viewName="AllContacts"></xp:dominoView>
            </xp:this.data>
            <xp:label
                value="This shows the in place editing capability" id="label5"
                style="font-weight:bold">
            </xp:label>
            <xp:br></xp:br>
            <xp:br></xp:br>
            <xp:pager layout="Previous Group Next" id="pager1"
                xp:key="header" for="repeat1" partialRefresh="true">
            </xp:pager>
            <xp:repeat id="repeat1" rows="15" value="#{view1}"
                var="row">
                <xp:div id="rowDataContainer">
                    User: &#160;
                    <xp:text escape="true" id="computedField1"
                        value="#{row.FirstName}">
                    </xp:text>
                    ,&#160;
                    <xp:text escape="true" id="computedField2"
                        value="#{row.LastName}">
                    </xp:text>
                    &#160;
                    <xp:span id="inform">
                        <xp:link escape="true" id="link1">
                            <xp:this.text><![CDATA[#{javascript:var c = getComponent("inPlaceForm1")
if(c.isVisible()) {
return "Close";
} else {
return "Edit"
}}]]></xp:this.text>
                            <xp:eventHandler event="onclick"
                                submit="true" refreshMode="partial" refreshId="inform">
                                <xp:this.action><![CDATA[#{javascript:var c = getComponent("inPlaceForm1")
c.toggle()
}]]></xp:this.action>
                            </xp:eventHandler>
                        </xp:link>
                        <xp:br></xp:br>
                        <xe:inPlaceForm id="inPlaceForm1"
                            partialEvents="true">
                            <xe:this.afterContentLoad><![CDATA[#{javascript:print("InPlaceForm: After Content Load")}]]></xe:this.afterContentLoad>
                            <xe:this.beforeContentLoad><![CDATA[#{javascript:print("InPlaceForm: Before Content Load")}]]></xe:this.beforeContentLoad>
                            <xp:panel>
                                <xp:this.data>
                                    <xp:dominoDocument
                                        var="document1" formName="Contact" action="editDocument"
                                        documentId="#{javascript:row.getNoteID()}"
                                        ignoreRequestParams="true">
                                    </xp:dominoDocument>
                                </xp:this.data>

                                <xp:table role="presentation">
                                    <xp:tr>
                                        <xp:td>
                                            <xp:label
                                                value="First name:" id="firstName_Label1"
                                                for="firstName1">
                                            </xp:label>
                                        </xp:td>
                                        <xp:td>
                                            <xp:inputText
                                                value="#{document1.FirstName}" id="firstName1"
                                                required="true">
                                            </xp:inputText>
                                        </xp:td>
                                        <xp:td>
                                            Required field, client
                                            side&#160;validation
                                        </xp:td>
                                    </xp:tr>
                                    <xp:tr>
                                        <xp:td>
                                            <xp:label
                                                value="Last name:" id="lastName_Label1" for="lastName1">
                                            </xp:label>
                                        </xp:td>
                                        <xp:td>
                                            <xp:inputText
                                                value="#{document1.LastName}" id="lastName1"
                                                required="true" disableClientSideValidation="true">
                                            </xp:inputText>
                                        </xp:td>
                                        <xp:td>
                                            Required field, server
                                            side validation
                                        </xp:td>
                                    </xp:tr>
                                    <xp:tr>
                                        <xp:td>
                                            <xp:label
                                                value="E mail:" id="eMail_Label1" for="eMail1">
                                            </xp:label>
                                        </xp:td>
                                        <xp:td>
                                            <xp:inputText
                                                value="#{document1.EMail}" id="eMail1">
                                            </xp:inputText>
                                        </xp:td>
                                        <xp:td></xp:td>
                                    </xp:tr>

                                <xp:tr><xp:td>Attachment</xp:td><xp:td>
<xp:fileUpload id="fileUpload1" value="#{document1.attachments}"></xp:fileUpload></xp:td><xp:td></xp:td></xp:tr></xp:table>
                                <xp:button value="Ok"
                                    id="button2">
                                    <xp:eventHandler event="onclick"
                                        submit="true" refreshMode="partial" refreshId="repeat1" immediate="false" save="true">
                                        <xp:this.action>
                                            <xp:actionGroup>
                                                <xp:saveDocument></xp:saveDocument>
                                                <xp:executeScript>
                                                    <xp:this.script><![CDATA[#{javascript:var c = getComponent("inPlaceForm1")
c.hide()}]]></xp:this.script>
                                                </xp:executeScript>
                                            </xp:actionGroup>
                                        </xp:this.action>
                                    </xp:eventHandler>
                                </xp:button>
                                <xp:button value="Label"
                                    id="button1">
                                <xp:eventHandler event="onclick"
                                    submit="true" refreshMode="partial" refreshId="repeat1">
                                    <xp:this.action><![CDATA[#{javascript:document1.save();
var c = getComponent("inPlaceForm1")
c.hide()}]]></xp:this.action>
                                </xp:eventHandler></xp:button></xp:panel>
                        </xe:inPlaceForm>
                    </xp:span>
                </xp:div>
            </xp:repeat>
        </xp:panel>
    </xp:panel>
</xc:OneUILayout>
</xp:view>

确保将文件上载控件绑定到富格文本字段。例如,对于名为rtf_field的富文本字段的数据document1,请使用{document1.rtf_field}


这里有一些工作代码,确保表单中有一个名为Main的表单和一个名为Body的Richtext字段

<?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">
    <xe:inPlaceForm id="inPlaceForm1"></xe:inPlaceForm>
    <xp:panel>
        <xp:this.data>
            <xp:dominoDocument var="d" formName="Main"></xp:dominoDocument>
        </xp:this.data>
        <xp:fileUpload id="fileUpload1" value="#{d.Body}"></xp:fileUpload>
        <xp:button value="Save" id="button1">
            <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:d.save()}]]></xp:this.action>
            </xp:eventHandler>
        </xp:button>
    </xp:panel>
</xp:view>

始终添加代码并接受匹配的答案Hanks Thomas,我希望文件上载控件在本地表单中,而不是在外部。如果我把它放在一边,它就不会工作了。我加了一个样品。
<?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">
    <xe:inPlaceForm id="inPlaceForm1"></xe:inPlaceForm>
    <xp:panel>
        <xp:this.data>
            <xp:dominoDocument var="d" formName="Main"></xp:dominoDocument>
        </xp:this.data>
        <xp:fileUpload id="fileUpload1" value="#{d.Body}"></xp:fileUpload>
        <xp:button value="Save" id="button1">
            <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
                <xp:this.action><![CDATA[#{javascript:d.save()}]]></xp:this.action>
            </xp:eventHandler>
        </xp:button>
    </xp:panel>
</xp:view>