What's the point of the xpages xp:include tags if the data with in it won't save from the calling xsp?

148 Views Asked by At

The one-ui app I'm building has a few forms each with a common custom control for the Save, Save and Close, Edit, Cancel, Delete buttons. These forms are built with several Tabbed Panels, which were created as separate xpages. These pages are called by main xpage using the include xp tag.

<xp:include pageName="sub_tab_6.xsp" id=include6"></xp:include>

This technique does a fine job of showing data and permitting data input, however any data input or edits are lost even if the Save button is clicked. Those fields on the main calling xpage get saved, however those data on included xpages (and those on form parts placed in Custom Controls , I tried that too) don't get saved.

I tried, for fun, putting a separate Save button on the sub-xpage, and this caused havoc with some fields going into Read Mode and Save Conflicts began to appear, of course.

Short of merging my sub-xpages into the main xpage, is there a better way of form design?

(Windows Client: Release 9.0.1 FP9 (Server: FP10, Longhorn64 6.1)

1

There are 1 best solutions below

0
On BEST ANSWER

If you use a custom control or include page, don't define your data source on it, but use the datasource name of your Xpage. For example: if you're datasource on the xpage is called document1; you can use document1 in your custom control or include, even if it is not defined there.

This will work fine if the datasource name is the same on all Xpages where you use the include or custom control. If you want a more dynamic approach, you can pass the datasource as a property of the custom control (and access it through compositeData). More details on this technique is answered here How to send a document data souce to a custom control in XPages?.