The following issue relates to Barry McGovern’s unanswered question about custom controls and data sources: link
I have an XPage setup as follows:
Tabbed Panel with 4 tabs.
Fields (mostly edit boxes) on first 3 tabs are bound to a document data source on the XPage.
The fourth tab contains a custom control, and the control contains a few more fields.
I need the fields in the custom control (tab 4) to be saved in the same document as the fields on the other tabs, but I can’t find a way to make that happen.
I’ve tried the following options without success:
Give the custom control its own data source with the same form as the XPage data source. Result: field values entered on tab 4 get saved in a separate document (with the specified form) to other fields on the XPage.
Give the custom control its own data source with the form set to the subform on which the control design is based. Result: field values entered on tab 4 get saved in a separate document (with the Form field set to the subform name) to other fields on the XPage.
Make the custom control have no data source, but use the Source view in Designer to bind the fields to the same data source name as the XPage. This was Barry McGovern’s solution, but it doesn’t work. Result: field values entered on tab 4 don’t get saved at all.
I know of the reported problem with saving data on tabs. It doesn’t matter how many times I click each tab before saving, I can only get the first three tabs to save data in one document, and the fourth tab’s data either gets saved in separate document, or not at all depending on the data-source used in the custom control.
Is there any way to link fields in a custom control to an XPage’s data source (or any other way to achieve the desired result) ?
Subject: Might the Tabbed Panel be the problem here?
There’s an issue with the tabbed panel where not all the data on the each panel gets saved when the document is submitted (fixed in FixPack1 and 851). Might this be causing your issue?The workaround for this is to review each panel before you submit - that’ll then save the data.
This is a first step. Get back eitherway
Subject: I already said I know of the tabbed panel problem; there’s more to this
I stated in my original post that I’m aware of the tabbed panel problem.
I have tried reviewing every tab before saving, and the result is that the fields on the first three tabs get saved in the correct document, but the fourth tab’s fields (which are defined in a custom control) either get saved in a separate document (if the control has its own data source) or don’t get saved at all (if the control does not have its own data source).
Subject: Sorry for the misunderstanding Scott. I see the issue now…
…looking into this to see if there is a technique to workaround this. And usually when using custom controls the data source binding is done on the custom control rather than the XPage.
Now in your case we have a requirement to have the data source declared in a number of places.
Subject: A little more info about my goal in this case…
I’m basically trying to use a custom control with fields in the same way as I’d use a subform with fields for Notes client development.
This application has a particular subform with a few fields used on several forms.
I’m currently trying to webify the app with XPages with the functionality as close to the Notes version as possible.
Ideally, I’d like to use a custom control matching the Notes subform, so those fields and part of the form layout only have to be maintained in one place.
If this can’t be done with a custom control, it means the fields have to be defined separately in every XPage they’re used on. Any change to those fields would have to be copied to every XPage. This situation make XPages seem like a step backwards for design maintenance.
Subject: Removing the data source from the Custom Controls and keeping the bindings on the controls should work.
I’ve tried just removing the data source from the custom controls but keeping the data bindings in the controls and I’ve found that I’m only saving one document.