I found a way of solving this problem here:
http://list.jahia.org/template_list/msg00534.html
Unfortunately, the reported solution has no real explanation.
Well it is a little tricky to explain, but basically the expressions access content that is on another page, notably the home page. In order to be able to view this content from other pages in live mode, the content *on the home page* must have been validated before it can be used in other pages.
In my case materialContainers and familyContainers are created in globals.inc page.
globals.inc is included in header.inc, so it is used for every single template.
One example of wrong code line should be:
materialValues.append(ExpressionMarker.drawMarker("currentSite.homePage.containerLists[\"materialContainer\"].getContainerByID("+materialContainer.getID()+").fields[\"materialValue\"].value", true));
that explicitly points to the homePage.
The first time that globals.inc is invoked is when home.jsp gets invoked, so probably the containers I am trying to find are considered to be related only to the homepage.
I would like to understand what happens when I invoke something like:
jData.containers().declareContainer( "projectCategoriesContainer", "Categories container", projectCategoriesFields );
Does the container created is related to a specific page, or is it possible to retrieve it in every page ?
In the declaration, nothing is created except for a definition. This definition is attached to the template in which it was declared. Only when you start inserting elements in the container list are the objects created. You can retrieve instances of container lists through the absolute addressing mechanism for container lists (aka getAbsoluteContainerList)
What happens if the declareContainer method is invoked multiple times in different jsp ?
Well if it's in the same template, the declaration will only happen once, but if it is in different templates, the declaration will be different since a definition is local to a template.
Gosh I really hope I can finish the template developer guide update soon, since a lot of this is already in there :(
Regards,
Serge Huber.
Jahia : A collaborative source CMS and Portal Server
www.jahia.org Community and product web site
www.jahia.com Commercial services company
