1

Crazy effect: I open a (previously saved) doc in read mode: Everthing is ok. When I change it into edit mode: All checkboxes are emptied. The other items (inputText, inputTextarea) on the xpage keep their values.

The effect doesn¨t occur when I open the page for the first time (of my browser session), but after that it happens every time.

code snippet:

        <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>
Uwe J.
  • 315
  • 1
  • 8
  • The first time you create the document the default value is used. When you have saved and edit the document the field binding is used. – Thomas Adrian Feb 09 '18 at 11:39
  • no - the first time (of my browser session), the values of the opened doc (which was saved earlier) are kept while changing to edit mode. Following trials, with this or with another doc, empty the checkbox items, when changing to edit – Uwe J. Feb 09 '18 at 14:32

1 Answers1

1

Your button has the property type="submit":

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

It is responsible for your issue.

Just delete type="submit" and your check boxes will work with setting edit mode by partial refresh:

    <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>
Knut Herrmann
  • 30,880
  • 4
  • 31
  • 67
  • Thanks Knut! That helps, at once :-) What is a bit awkward: In the UI properties of that button, tab "Button", the button type ist shown as Button, while in the source (and in the All Properties tab) the type is "submit". – Uwe J. Feb 15 '18 at 13:17
  • My guess is that someone copied the code of an HTML-button into the XPages source code and changed it to xp:button... As you mentioned, you can't add this property in Domino designer UI, just manually in source code. – Knut Herrmann Feb 15 '18 at 17:59