Xpages xpage document不会保存新文档,但会保存已编辑的现有文档

Xpages xpage document不会保存新文档,但会保存已编辑的现有文档,xpages,xpages-extlib,Xpages,Xpages Extlib,我有一个我创建的xapage,其中列出了表单等。当我使用它创建新文档时,它不会保存文档。但是,如果我编辑使用notes表单创建的现有文档,它会保存该文档。这很奇怪。没有任何错误消息,它只是用空字段重新加载文档。下面是我的源代码: <?xml version="1.0" encoding="UTF-8"?> <xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xe="http://www.ibm.com/xs

我有一个我创建的xapage,其中列出了表单等。当我使用它创建新文档时,它不会保存文档。但是,如果我编辑使用notes表单创建的现有文档,它会保存该文档。这很奇怪。没有任何错误消息,它只是用空字段重新加载文档。下面是我的源代码:

    <?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">

    <xp:this.data>
        <xp:dominoDocument var="document1" action="openDocument"
            formName="frmComm" computeWithForm="onsave">
        </xp:dominoDocument>
    </xp:this.data>

    <xp:this.dataContexts>
    <xp:dataContext var="parentDoc">
        <xp:this.value><![CDATA[#{javascript:
            try {
                if (document1.isResponse()) {
                    return database.getDocumentByUNID(document1.getDocument().getParentDocumentUNID());
                } else {
                    return "";
                }
            } catch(e) {
                return "";
        }}]]></xp:this.value>
    </xp:dataContext>
</xp:this.dataContexts>



    <xc:AppLayout>
        <xp:this.facets>
            <xp:panel xp:key="facetMiddle">

                <xp:panel>
                    <xc:ccFormActions></xc:ccFormActions>

                    <xp:panel>
                        <xp:panel><xe:formTable id="formTable1" formTitle="Communication">
        <xe:formColumn id="formColumn2">
            <xe:formRow id="formRow14" label="Policy Name:" rendered="#{javascript:document1.isEditable()}">
                <xp:inputText id="inputText1" value="#{document1.NameC}"
                    style="width:630.0px"
                    rendered="#{javascript:document1.isEditable()}" readonly="true">
                <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("Name");
}]]></xp:this.defaultValue></xp:inputText>
            </xe:formRow>
            <xe:formRow id="formRow11" label="Policy Name:" rendered="#{javascript:!document1.isEditable()}">
                <xp:text escape="true" id="NameV" value="#{document1.NameC}" rendered="#{javascript:!document1.isEditable()}">
                </xp:text>

            </xe:formRow>
            <xe:formRow id="formRow12" label="Policy Number:" rendered="#{javascript:document1.isEditable()}">
                <xp:inputText id="inputText4" value="#{document1.NbrC}" rendered="#{javascript:document1.isEditable()}" readonly="true">
                <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("Nbr");}]]></xp:this.defaultValue></xp:inputText>
            </xe:formRow>
            <xe:formRow id="formRow13" label="Policy Number:" rendered="#{javascript:!document1.isEditable()}">
                <xp:text escape="true" id="NbrV" value="#{document1.NbrC}" rendered="#{javascript:!document1.isEditable()}">
                </xp:text>

            </xe:formRow>
            <xe:formRow id="formRow10" label="Category:" rendered="#{javascript:document1.isEditable()}">
                <xp:inputText id="inputText5" style="width:169.0px" value="#{document1.CategoryC}" rendered="#{javascript:document1.isEditable()}" readonly="true">
                <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("Category");}]]></xp:this.defaultValue></xp:inputText>
            </xe:formRow>
            <xe:formRow id="formRow9" label="Category:" rendered="#{javascript:!document1.isEditable()}">
                <xp:text escape="true" id="CategoryV" value="#{document1.CategoryC}" rendered="#{javascript:!document1.isEditable()}">
                </xp:text>

            </xe:formRow>
            <xe:formRow id="formRow8" label="Sub Category:" rendered="#{javascript:document1.isEditable()}">
                <xp:inputText id="inputText7" value="#{document1.SubCategoryC}" rendered="#{javascript:document1.isEditable()}" readonly="true">
                <xp:this.defaultValue><![CDATA[#{javascript:parentDoc.getItemValueString("SubCategory");}]]></xp:this.defaultValue></xp:inputText>
            </xe:formRow>
            <xe:formRow id="formRow1" label="Sub Category:" rendered="#{javascript:!document1.isEditable()}">
                <xp:text escape="true" id="SubCategoryV" value="#{document1.SubCategoryC}" rendered="#{javascript:!document1.isEditable()}">
                </xp:text>

            </xe:formRow>
            <xe:formRow id="formRow2" label="Quarter / Year:" rendered="#{javascript:document1.isEditable()}">
                <xp:comboBox id="comboBox1" value="#{document1.ComQtr}" style="margin-right:10.0px" rendered="#{javascript:document1.isEditable()}">
                    <xp:selectItem itemLabel="Q1"></xp:selectItem>
                    <xp:selectItem itemLabel="Q2"></xp:selectItem>
                    <xp:selectItem itemLabel="Q3"></xp:selectItem>
                    <xp:selectItem itemLabel="Q4"></xp:selectItem>
                </xp:comboBox>
                <xp:comboBox id="comboBox2" value="#{document1.ComYr}"
                    rendered="#{javascript:document1.isEditable()}"
                    style="width:58.0px">




                    <xp:selectItems>
                        <xp:this.value><![CDATA[#{javascript:var profDoc:NotesDocument = database.getProfileDocument("configdoc","");

return
profDoc.getItemValue("cfgCYear");}]]></xp:this.value>
                    </xp:selectItems>
                </xp:comboBox>
            </xe:formRow>
            <xe:formRow id="formRow3" label="Quarter / Year:" rendered="#{javascript:!document1.isEditable()}">
                <xp:text escape="true" id="QtrYr" rendered="#{javascript:!document1.isEditable()}"><xp:this.value><![CDATA[#{javascript:document1.getItemValueString("ComQtr") + " " + document1.getItemValueString("ComYr")}]]></xp:this.value></xp:text>

            </xe:formRow>
            <xe:formRow id="formRow4" label="Date:">
                <xp:inputText id="inputText2"
                    value="#{document1.ComDt}">
                    <xp:this.converter>
                        <xp:convertDateTime type="date"
                            dateStyle="short">
                        </xp:convertDateTime>
                    </xp:this.converter>
                    <xp:dateTimeHelper></xp:dateTimeHelper>
                </xp:inputText>
            </xe:formRow>
            <xe:formRow id="formRow5" label="Activity">
                <xp:inputTextarea id="inputTextarea1"
                    style="width:413.0px;height:84.0px" value="#{document1.ComActivity}">
                </xp:inputTextarea>
            </xe:formRow>
            <xe:formRow id="formRow6" label="Comments:">
                <xp:inputRichText id="inputRichText1" value="#{document1.ComComments}"></xp:inputRichText>              
            </xe:formRow>
            <xe:formRow id="formRow7" label="Edit Policy Information:">
                <xp:checkBox text="Edit" id="checkBox1" value="#{document1.EditPol}" checkedValue="Edit"></xp:checkBox>

            </xe:formRow>
        </xe:formColumn>

    </xe:formTable></xp:panel>
                    </xp:panel>
                </xp:panel>
            </xp:panel>
        </xp:this.facets>

    </xc:AppLayout><xp:this.navigationRules><xp:navigationRule outcome="xsp-failure" viewId="/communications.xsp"></xp:navigationRule></xp:this.navigationRules></xp:view>


这已解决。与经典notes开发不同,如果form属性设置为document而不是response,则在使用操作create response时不会保存文档。因此,将属性更改为响应就解决了问题。

您有权在ACL中创建文档?对于代码示例来说,这需要很多东西。如果您的ACL正常,我建议您尝试用最少的元素和代码重现问题。如果您更改数据的默认操作以创建新文档而不是openDocument,该怎么办。然后会发生什么?如果有任何错误抛出,请检查控制台。我可能是因为computewithform正在生成某种错误,而这些错误不会显示给用户。另外,在页面顶部添加一个常规错误控件。如果与此无关,请忽略此项,我没有完全理解示例…我已经看到,在保存新文档并尝试获取parentID时,代码getParentId()返回NOTEID,但在保存现有文档时,相同的调用返回您找到的UNIDGreat。我相信如果没有
computeWithForm=“onsave”
,它会工作的。谢谢你,我今晚也会探索这条路。@PanuHaaramo,你说得对,用表单删除compute也会工作。也谢谢你