XPages – Saving data sources bound to a panel – a lesson learned

In this article I will highlight/document an issue which I came across today – using a Save Button and a Document Data source bound to a panel.

so this is what I learned today

When you have an xpages document data source bound to a panel

 <xp:panel id="widgetContentsWrapper" styleClass="widgetContentsWrapper">
   <xp:dominoDocument var="widgetsDoc" formName="Widgets"  scope="request">

and a save button to “saveDocument”

  <xp:button styleClass="btn btn-primary modal-ok" value="Submit Button" id="button1" disableTheme="true" >
   <xp:eventHandler event="onclick" submit="true" refreshMode="complete">
      <xp:saveDocument var="widgetsDoc"></xp:saveDocument>

The button must be within the panel – otherwise for absolutely no apparent reason it just does not work. I checked the form – yes data was being submitted but apparently not saved.

I have never experienced this before because I have never used a data source bound to a panel before – now I know better!

I hope you do not have to share my pain…


5 thoughts on “XPages – Saving data sources bound to a panel – a lesson learned

  1. Yeah, I just dealt with something similar. I have a custom control in xe:appPage; the data source was defined in the custom control, but I wanted a save action in the xe:djxmHeading. So I had to move the data source out to a panel on xe:appPage encompassing both xe:djxmHeading and the custom control. I wasted much time! Also, it’s a bit awkward, as the data source is now invisible to me when designing the custom control.

  2. Data sources are only visible / reachable from inside of the context where there are defined. If you are adding a datasource to a panel or a custom control, you cannot access it directly from “outside” (see here how to do it: http://hasselba.ch/blog/?p=777).

    Inside of the context, the data sources are reachable. This means that the panel knows the datasource from the UIRoot, or a nested custom control knows the datasources of the panel and so on…

    The save action just ignores a missing datasource and throws no error message.

  3. Yup…Just set up a panel, set up a form control within it, set up an action to save the document within the control and wouldn’t save. Got rid of the panel and everything was hunky dory. Seems the action was outside the panel. But thanks for the tip!

  4. I create the data source in the , you can save the document , but this field is null , another inputtext not using Tokeninput , the field can save into document .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s