0

I have a xpage, with multiple tabs. First tab contains a panel, whose content are editable only when isNewNote() is true. So I computed readonly attribute for the panel.

But everytime I save the document, it is creating a new conflict document.

At the sametime,if I uncheck read-only property, it is saving properly without any conflict.

Can anybody help me to solve this issue?

CODE - Xpage

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:this.data>
        <xp:dominoDocument var="document1"
            formName="frmOnboardingRequest">
        </xp:dominoDocument>
    </xp:this.data>
    <xp:panel>
        <xp:this.readonly><![CDATA[#{javascript:if(document1.isNewNote()){
    return false;
}else{
    return true;
}}]]></xp:this.readonly>
        <xp:table>
            <xp:tr>
                <xp:td>
                    <xp:label value="O n_ e d_ form completed by:"
                        id="oN_ED_FormCompletedBy_Label1" for="oN_ED_FormCompletedBy1">
                    </xp:label>
                </xp:td>
                <xp:td>
                    <xp:inputText
                        value="#{document1.ON_ED_EmployeeName}"
                        id="oN_ED_FormCompletedBy1">
                    </xp:inputText>
                </xp:td>
            </xp:tr>
        </xp:table></xp:panel>
    <xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete" immediate="false" save="true"></xp:eventHandler></xp:button></xp:view>
Saravanan
  • 1,237
  • 2
  • 18
  • 25
  • One more link with slightly similar issue, but their suggestions did not work for me :( - [Strange bug in XPages in 8.5.2...](http://julianbuss.net/web/youatnotes/blog-jb.nsf/dx/unbelievable-bug-in-xpages-in-8.5.2....htm?opendocument&comments) – Saravanan Jan 09 '14 at 13:27

3 Answers3

4

Check for multiple datasources pointing to the same document.

Some posts before with the same problem xpage creates save conflict on save/submit

Multiple data sources in XPages

Lotus Notes: Replication conflict caused by agent and user running on the document at same time

=================================================

Edit

I had to change the button code to this to get the same problem

  <xp:button value="Submit" id="button1"><xp:eventHandler event="onclick" refreshMode="complete" submit="true">
    <xp:this.action>
        <xp:saveDocument></xp:saveDocument>
    </xp:this.action></xp:eventHandler></xp:button>

After some more testing, try this.

Add this field to the end of the xpage

<xp:inputText id="inputText1"
        value="#{document1.temp}"
        style="visibility:hidden;display:none">
    </xp:inputText>

Then no conflicts are created.

Community
  • 1
  • 1
Fredrik Norling
  • 3,461
  • 17
  • 21
  • Thanks. I am having only one datasource and I am saving that only on onclick of a button. The confusing part is, no conflict document is created when I uncheck "Read-Only" property of a panel. – Saravanan Jan 09 '14 at 11:51
  • I have included a simple xpage to the main post to simulate this – Saravanan Jan 09 '14 at 12:09
  • Interesting, I've never tried this before. After changing concurrent mode this error is shown "Document has been saved by another user - Save has been cancelled" and that isn't the case :-) – Fredrik Norling Jan 09 '14 at 14:13
  • 1
    It seems having just one field on the XPage is the issue. I think it's because the browser sees a form with a single field as needing to be submitted, so the basic submission calls the form action to save and the button calls a save. Ironically, the original document is not modified and the conflict is not double-saved either. Hiding a second field is all that's needed. – Paul Stephen Withers Dec 23 '15 at 10:32
0

Strange indeed - but also not. Your data source is bound to the page and not to the panel. So if you want to set read mode only for that panel, consider to calculate the panel's datasource from the page's datasource:

<xp:panel>
    <xp:this.data>
        <xp:dominoDocument var="document1" action="openDocument"></xp:dominoDocument>
    </xp:this.data>
</xp:panel>

Of course you have to calculate the document mode and the docid instead of using the readonly property.

Oliver Busse
  • 3,375
  • 1
  • 16
  • 26
0

In addition to the other suggestions, when working with tabbed tables you will want to follow this blog post carefully. I have been through similar issues on a previous project and Tommy Valand's redirectToCurrentDocument() fixed them.

http://dontpanic82.blogspot.com/2010/06/xpages-avoid-saving-duplicate-documents.html

Steve Zavocki
  • 1,840
  • 4
  • 21
  • 35