I've got a repeat control with a series of documents, and below that on the same panel but outside the repeat control I have another bound document that is new. The new document has blank fields, but the fields have validation which requires content when the new document is submitted.
That works.
I've added an "edit" button to the repeat entry panel on the repeat control. The action is to pop that entry ento edit mode.
That works - and I can confirm that the individual rows on the repeat can toggle between edit mode independently, and that when toggling, the new document below does not toggle. It is left alone.
However,
If I have validation code on the new document, it triggers (which fails validation) on the new document even though I'm toggling one of the other bound documents in the repeat.
I have tried to make sure the button is set to partial refresh, and is only set to refresh the individual entry panel within the repeat, and I've tried to make sure the buttons are only bound to the right documents.
It appears to be only the validation code that is at issue, since if I disable it all the toggling works fine and the new document area does NOT create an empty new document in its target database.
Clearly I am missing something. Any thoughts?
If you want code, I've posted a stripped, sanitized, and annotated version as short as I could make it without removing the related bits here:
<xp:repeat repeatControls="false" var="devices" id="ExistingDevicesList" rendered="true">
<xp:this.value><![CDATA[#{javascript: /* Some script that populates the repeat */ }]]>
</xp:this.value>
<xp:panel id="IndividualDevice"> <!-- ************ start of the individual device panel -->
<xp:this.data>
<xp:dominoDocument var="devDocument"
databaseName=" xxxxx.nsf" action="openDocument"
formName="device"
documentId="#{javascript:devices.getDocument().getUniversalID();}"
ignoreRequestParams="true" />
</xp:this.data>
<!-- ******************* The Edit Button ****************** -->
<xp:button value="Edit" id="button1">
<xp:this.binding><![CDATA[#{javascript:
var IndividualDevice:com.ibm.xsp.component.UIPanelEx = getComponent("IndividualDevice");
IndividualDevice}]]>
</xp:this.binding>
<xp:eventHandler event="onclick"
submit="true" refreshMode="partial"
refreshId="IndividualDevice">
<xp:this.action>
<xp:changeDocumentMode mode="edit" var="devDocument">
</xp:changeDocumentMode>
</xp:this.action>
</xp:eventHandler>
</xp:button>
<!-- ******************************************************* -->
<xp:inputText id="inputText4" value="#{devDocument.field1}" />
<xp:inputText id="inputText5" value="#{devDocument.field2}" />
</xp:panel>
</xp:repeat>
<!-- ********** below is a field and button bound to the NewDevice Document -->
<xp:inputText id="inputText3" value="#{NewDevice.field1}"
style="width:371.0px" required="false">
<xp:this.validators>
<xp:validateRequired
message="You must enter a value." />
</xp:this.validators>
</xp:inputText>
<xp:button value="submit new device" id="newDevButton">
<xp:eventHandler event="onclick" submit="true"
refreshMode="partial" immediate="false" save="true"
refreshId="NewDevicePanel" />
</xp:button>
<!-- ************************************************************************ -->
Try addind the following settings to your Edit button:
execMode="partial" execId="IndividualDevice"
This will ensure that the partial refresh only runs on the IndividualDevice panel, so the validation on the NewDevice datasource is not run. This will also be better for performance, because it reduces the elements in the component tree (server-side map of the XPage) being processed by the partial refresh.
I was able to reproduce your problem with the code, but when I added the above properties, I was able to toggle documents in the repeat successfully.