Create a sheet for two objects, where objects are on different pages


We have two objects of two different Classes, each on it’s own page.

We looked, for a example,

## get the document which has the object (only one here) - this is the page where I can see things in the object editor
## Retrieve the first object (index [0]) among all objects attached to the page MySpace.MyDocWithMyClassObjects and of a certain class MySpace.MyClass
#set( $MyDoc = $xwiki.getDocument("MySpace.MyDocWithMyClassObjects"))
## get the document wich contains the class definition: this page has entries in the class editor
#set( $class = $xwiki.getClass("MySpace.MyClass"))
#foreach($prop in $ ## go through all properties
  * ${prop.prettyName} : $MyDoc.display($prop.getName())

our implementation is a bit different as we have two objects to manage:

## first the object on this page ($doc)
#set($class = $doc.getObject('Sandbox.testClassOOPage1').xWikiClass)
#foreach($prop in $
  ; $prop.prettyName
  : $doc.display($prop.getName())

## then the object (of a different class) on another page
#set($docClass2 = $xwiki.getDocument('Sandbox.testClassOOPage2Example') )
#set($objectOfClass2 = $docClass2.getObject('Sandbox.testClassOOPage2').xWikiClass)

#foreach($class2Prop in $
  ; $class2Prop.prettyName
  : $docClass2.display($class2Prop.getName())

This works fine in view mode…
But the problem is that we also need EDIT mode (inline)

The form seems ok before saving , we have input controls for both objects (of different classes). We also see the data of both objects
But when I modify the data of the second object in the form and press SAVE & VIEW the modification is not saved…

How can we achieve our goal

You have this issue when you create a new page or also when you edit a page which already have those two objects ?

This is the kind of behavior you would have if the template you use when you create your page only contain one object but it’s not very clear from your message what is you context so I would need more details.