This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 11, 2011, 9:12 PM
66 Posts

Two document datasources on one page, how to save just one?

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 3
 I have two datasources on one page with two forms on web page with individual submit buttons. How to allow that just one datasource(document) is saved  depending on which submit button had been pressed. Also just validation on submited form must be applied. Any solution?
 
David 
Mar 11, 2011, 9:54 PM
41 Posts
Re: Two document datasources on one page, how to save just one?
 There are several ways to address this, but the easiest is to execute SSJS that refers to the target data source by name. For example:
 
<xp:panel>
<xp:this.data>
<xp:dominoDocument var="secondDataSource" form="someForm" />
</xp:this.data>
<xp:button value="Save Second Data Source" id="button1">
<xp:eventHandler event="onclick" submit="true"
refreshMode="complete">
<xp:this.action><![CDATA[#{javascript:secondDataSource.save();}]]></xp:this.action>
</xp:eventHandler>
</xp:button>
</xp:panel>
 
This should only cause the named data source to save. If you make the save event a partial refresh targeting just the panel that contains the target data source, and set the event to partial execution mode, that should skip validation for components bound to the other data source.
Mar 12, 2011, 8:26 AM
149 Posts
Re: Two document datasources on one page, how to save just one?
You also need to set the data source scope to "request"
http://blog.youatnotes.de/web/youatnotes/blog-jb.nsf/dx/calling-xpage-gurus-submit-button-to-submit-only-one-datasource-instead-of-all-datasources.htm?opendocument&comments
 
 Good Luck
Thomas
Mar 12, 2011, 10:00 PM
41 Posts
only if you want the secondary form automatically cleared after saving
  When setting a data source scope to request, that means a new "document" is created with each event. So that's useful for pages like blog entries where the entry itself is the primary data source and the secondary source is for adding comments... but in situations where both data sources need to respond to events, the scope needs to be left as the default (view).

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal