Jan 20, 2016, 11:24 AM
3 Posts

Save creates multiple rep conflicts

  • Category: Other
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: rep conflicts
  • Replies: 6

I'm trying to develop my first xPages app and I seem to be failing to understand some key concept...

I've created an xpage to be used to update a document.  The document has lots of fields, so I have a tabbed panel with 4 tabs all bound to the same document.  When I save, it seems to submit once for each tab that has updates, but always at least 2 times, so I get the document updated with some of the updates and 1, 2 or 3 rep conflicts created with the rest of the updates.  For ease of development and reusability reasons, I put my tabbed panel in a custom control and also my save button in another custom control.  The custom controls have the same data binding as the xpage.

I have tried searching this topic and found several postings, but nothing that solves my problem. 

I am happy to provide source code if that will help ...

 

Thanks!

 

 

 

Jan 20, 2016, 12:30 PM
453 Posts
As I remember ....

when I first started with XPages that I too used the tab panel, and if my memory serves me correctly I had a similar problem. I no longer use the tab panel what I now do is create a number of links that set a viewScope variable that I use to set the style property of a related panel. In the style property I set the panel to display something like this"

  if (!viewScope.containsKey("vsShowPanel")){
        viewScope.vsShowPanel = "Header";
    }
    var showPanel:String = viewScope.vsShowPanel;
    (showPanel == "Header" ) ? "" : "display:none";
    

I use this rather than the visible property because the visible property does a bunch more than just making the object visible or hidden. Then my navigation link sets the value of vsShowPanel

<li role="presentation" class="active">
                            <xp:link id="headerLink" text="Header">
                                <xp:this.attrs>
                                    <xp:attr name="data-toggle" value="tab">
                                    </xp:attr>
                                </xp:this.attrs>
                                <xp:eventHandler event="onclick" submit="true"
                                    refreshMode="partial" refreshId="panelMain">
                                    <xp:this.action><![CDATA[#{javascript:viewScope.vsShowPanel = "Header"}]]></xp:this.action>
                                </xp:eventHandler>
                            </xp:link>
 </li><!-- li role= -->

i'm using BootStrap to format the link display.

By doing this you have full access to all controls (fields) on your page no matter whether they are being displayed or not. You will need to make sure that your link refreshes links and the panels, I just include them all in the panelMain. 

I don't know if this is the best way to accomplish this but it works for me and appears to respond quickly even when there are a lot of panels (tabs) and a fair bit of computed info.

A side benefit is that you can put lots of different logic onto your page fairly easily by hiding links and panels under different circumstances. 

Hope this helps.

Bill

Jan 21, 2016, 4:30 PM
3 Posts
Thanks Bill

I'm working through this and it l'm sure it will solve my problem. 

 

Thanks again,

Rob

Jan 21, 2016, 6:11 PM
453 Posts
Glad to Help

 

Jan 22, 2016, 5:39 PM
453 Posts
Something to remember

The visible property does not simply hide the control from the user it makes it unavailable. The property name can cause a lot of problems that is why I use the "display:none" style property.

Jan 23, 2016, 11:37 AM
589 Posts
code

If this is still a problem then please post the code.

 

Thanks

Dave

NotesIn9.com

Jan 27, 2016, 8:13 AM
3 Posts
Finally solved!

I got my little application to work using panels with buttons to change the style.display from none to block.  Then I thought I would re-create the problem so I could post the source code here, but this time the tabbed panels work fine - no rep conflicts.  I did a couple of things differently:

  1. I had a computed field on my form with formula versionnumber := versionnumber + 1;  I removed that and put it on the save button on my xpage.
  2. changed my save button from button type 'submit' to button type 'button' with server side actions of modify field, save document and open page
  3. not sure if this had any impact, but I a few components included the tabbed panel in custom controls and this time I put it all in the xpage so that the data source was only specified once on the xpage - before I had specified it on the xpage and a couple of different custom controls...

Thanks all for you help and comments.