Compute the Datasource of a Save Simple Action from within a Custom Control


<!--Parent Control or Xpage using form control-->
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" xmlns:xc="http://www.ibm.com/xsp/custom"
	xmlns:xe="http://www.ibm.com/xsp/coreex">
	<xp:this.data>
		<xp:dominoDocument var="docRelease" databaseName="${settings.dbProjects.path}"
			formName="release" documentId="#{javascript:compositeData.releaseDocNoteID}">
		</xp:dominoDocument>
	</xp:this.data>
	<xc:ccForm doc="#{docRelease}" parentPanel="pChildDoc"></xc:ccForm>
</xp:view>

<!--Form Control containing save action-->
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
	<xp:this.dataContexts>
		<xp:dataContext var="parentPanel" value="${compositeData.parentPanel}">
		</xp:dataContext>
		<xp:dataContext var="doc" value="#{javascript:compositeData.doc}">
		</xp:dataContext>
	</xp:this.dataContexts>

	<div class="form-horizontal">

		<!--  bla bla-->

		<xp:callback id="callback1"></xp:callback>
		<div class="form-actions">

			<xp:button value="Save" id="button1" styleClass="btn btn-primary"
				rendered="#{javascript:doc.isEditable()}">
				<i class="icon-ok icon-white" />
				<xp:eventHandler event="onclick" submit="true"
					refreshMode="partial" refreshId="${javascript:compositeData.parentPanel}">
					<xp:this.action>
						<xp:saveDocument var="doc">
						</xp:saveDocument>
					</xp:this.action>
				</xp:eventHandler>
			</xp:button>
		</div>
	</div>
</xp:view>
All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.
No comments yetLogin first to comment...