XPages:复选框(组)在更改为编辑模式

时间:2018-02-09 11:31:18

标签: xpages xpages-extlib

疯狂效果:我在阅读模式下打开(以前保存过的)doc:Everthing没问题。当我将其更改为编辑模式时:所有复选框都被清空。 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>

1 个答案:

答案 0 :(得分:1)

您的按钮的属性为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>