Form for 2 objects on different pages

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Form for 2 objects on different pages

Gerritjan Koekkoek-2
[[Note: The XWiki project is switching away from this mailing list and moving to a forum: This list will be made readonly in a few days. Please post on the forum from now on. Thanks.]]


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

Gerritjan Koekkoek
Vader van Rai Koekkoek (cdls) en voorzitter vereniging CdLS
Visit our website<>
email<[hidden email]>