XPages:复选框(组)在更改为编辑模式时丢失其值

XPages: checkbox (groups) looses their value(s) when changing to edit mode

疯狂效果:我以阅读模式打开一个(之前保存的)文档:一切正常。当我将其更改为编辑模式时:所有复选框都被清空。 xpage 上的其他项目(inputText、inputTextarea)保留其值。

当我第一次(在我的浏览器会话中)打开页面时不会出现这种效果,但之后每次都会出现。

代码片段:

        <xp:panel id="pNewDoc" styleClass="panel panel-default">
        <xp:this.data>
            <xp:dominoDocument var="dshare" formName="dshare"
                action="openDocument"
                databaseName="webapp/peoplesearch/dshare.nsf">
                <xp:this.documentId><![CDATA[#{javascript:viewScope.myUnid}]]></xp:this.documentId>
            </xp:dominoDocument>
        </xp:this.data>
        <xp:this.rendered><![CDATA[#{javascript:viewScope.ShowDoc == "1"}]]></xp:this.rendered>
        <div class="panel-heading">
            <xp:label value="Desk Sharing Freigabe" id="label7"
                for="inputText1" styleClass="panel-title">
            </xp:label>
        </div>
        <xp:div styleClass="panel-body">
            <div class="row hvrow">
                <xp:label value="Owner" id="label2"
                    styleClass="col-sm-2 col-md-2">
                </xp:label>
                <xp:div styleClass="col-sm-4 col-md-4">
                    <xp:inputText id="inputText4"
                        value="#{dshare.anOwner}"
                        defaultValue="#{javascript:@UserName()}" disabled="true">
                    </xp:inputText>
                </xp:div>
                <xp:label value="Tel." id="label6"
                    styleClass="col-sm-2 col-md-2">
                </xp:label>
                <xp:div styleClass="col-sm-4 col-md-4">
                    <xp:inputText id="inputText5"
                        value="#{dshare.dsPhoneNumber}">
                        <xp:this.defaultValue><![CDATA[#{javascript:var 
                dbArray = [""];
                dbArray.push("webapp/peoplesearch/psuser_20160610.nsf")
           @DbLookup(dbArray,"lookupFullname",@UserName(),"OfficePhone")}]]></xp:this.defaultValue>
                    </xp:inputText>
                </xp:div>
            </div>
            <div class="row">
                <xp:label value="Von bis" id="label1"
                    styleClass="col-sm-2 col-md-2">
                </xp:label>
                <xp:div
                    styleClass="col-sm-4 col-md-4 form-inline">
                    <xp:inputText id="inputText1"
                        value="#{dshare.dsFrom}" style="width:45%">
                        <xp:dateTimeHelper id="dateTimeHelper3">
                        </xp:dateTimeHelper>

                        <xp:this.converter>
                            <xp:convertDateTime type="date"
                                dateStyle="short">
                            </xp:convertDateTime>
                        </xp:this.converter>
                    </xp:inputText>

                    &#160;-&#160;
                    <xp:inputText id="inputText2"
                        value="#{dshare.dsTo}" style="width:45%">
                        <xp:dateTimeHelper id="dateTimeHelper4">
                        </xp:dateTimeHelper>

                        <xp:this.converter>
                            <xp:convertDateTime type="date"
                                dateStyle="short">
                            </xp:convertDateTime>
                        </xp:this.converter>
                    </xp:inputText>
                </xp:div>
                <xp:label value="Zeitspanne" id="label3"
                    styleClass="col-sm-2 col-md-2">
                </xp:label>
                <xp:div styleClass="col-sm-4 col-md-4">
                    <xp:checkBoxGroup id="checkBoxGroup1"
                        value="#{dshare.dsPeriod}">
                        <xp:selectItem itemLabel="Vormittag"
                            itemValue="V">
                        </xp:selectItem>
                        <xp:selectItem itemLabel="Nachmittag"
                            itemValue="N">
                        </xp:selectItem>
                    </xp:checkBoxGroup>
                </xp:div>
            </div>
            <div class="row">
                <xp:label value="Details" id="label9"
                    styleClass="col-sm-2 col-md-2">
                </xp:label>
                <xp:div styleClass="col-sm-10 col-md-10">
                    <xp:inputTextarea id="inputTextarea1"
                        style="width:100%" rows="5" value="#{dshare.dsDetails}">
                    </xp:inputTextarea>
                </xp:div>
                <xp:label value="Status" id="label10"
                    styleClass="col-sm-2 col-md-2">
                </xp:label>
                <xp:div styleClass="col-sm-4 col-md-4">
                    <xp:checkBox text="aktiv" id="checkBox1"
                        value="#{dshare.dsStatus}" checkedValue="activ"
                        uncheckedValue="inactiv" defaultChecked="true">
                    </xp:checkBox>
                </xp:div>
            </div>
        </xp:div>
        <div class="panel-footer" style="text-align:right">

            <xp:button value="Bearbeiten" id="btEdit" type="submit"
                rendered="#{javascript:!dshare.isEditable()}">
                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="partial" immediate="false" save="false"
                    refreshId="pNewDoc" execMode="partial" execId="pNewDoc">
                    <xp:this.action>
                        <xp:changeDocumentMode mode="edit"></xp:changeDocumentMode>
                    </xp:this.action>
                </xp:eventHandler>
            </xp:button>
            <xp:button value="Speichern" id="btSave" type="submit"
                rendered="#{javascript:dshare.isEditable()}">
                <xp:eventHandler event="onclick" submit="true"
                    refreshMode="partial" immediate="false" save="false"
                    refreshId="pDSall" execMode="partial" execId="pDSall">
                    <xp:this.action><![CDATA[#{javascript:viewScope.ShowDoc = "0"
 qsave(dshare);}]]></xp:this.action>
                </xp:eventHandler>
            </xp:button>
        </div>
    </xp:panel>

您的按钮有 属性 type="submit":

    <xp:button
        value="Bearbeiten"
        id="button2"
        type="submit"
        rendered="#{javascript:!dshare.isEditable()}">
    ...

它对你的问题负责。

只需删除type="submit",您的复选框将通过部分刷新与设置编辑模式一起使用:

    <xp:button
        value="Bearbeiten"
        id="btEdit"
        rendered="#{javascript:!dshare.isEditable()}">
        <xp:eventHandler
            event="onclick"
            submit="true"
            refreshMode="partial"
            immediate="false"
            save="false"
            refreshId="pNewDoc"
            execMode="partial"
            execId="pNewDoc">
            <xp:this.action>
                <xp:changeDocumentMode mode="edit"></xp:changeDocumentMode>
            </xp:this.action>
        </xp:eventHandler>
    </xp:button>