OpenCms allows to make fields in the content editor dependent on other fields. You can listen to changes made in an editor field and then react on that change by adjusting values in other fields. Potentially, you can react also in a different way if you write your own change handler. Which handler listens to which editor fields (or, more precise, to changes on which schema elements) is configured in the schema definition of a content type.

Why should I make editor fields dependent?

You may run into a scenario, where the value of one schema element is somehow related to the value of another schema element (or even of many other such elements). When a content is edited in the content editor and the editor field that displays a schema element changes, it may be valuable to adjust the value displayed in another editor field.

An example are copyright information on images. Your content may allow to insert images and set copyright information on such images. If a picture is exchanged, the copyright information should be adjusted accordingly (possibly read from a property of the picture).

Configuration of editor change handlers

To configure dependent fields, you need to register an editor change handler to a schema element in the schema definition of a content type. Handlers are added under xsd:annotation/xsd:appinfo in a subnote <editorchangehandlers>. Here's an example:

        scope="Image" configuration="Copyright|../CopyText" />

Inside the node <editorchangehandlers> you can define different change handlers via the node <editorchangehandler> that has the following attributes.

Attributes of <editorchangehandler>

The class that handles the dependency. By default, OpenCms provides CmsEditorChangeHandlerProperty as concrete handler implementation, but you can write own handlers.


Define the editor fields that should be observed for changes. The fields have to be specified by an XPath, e.g., "Paragraphs*/Headline". The path can contain * as wildcard to observe all elements in a sequence. Moreover, the path can also explictely addess one element in a series and all fields of a subcontent. For example, "Paragraphs[2]" would cause observation for all fields in the second paragraph.


Configuration is handler specific, hence it depends on the class you specified in the class attribute. For example, the CmsEditorChangeHandlerProperty takes a property name and the path to the field that should be updated with the property, where the two are separated by |. The path can be given relative to the observed field or absolute.

Available editor change handlers

By default, OpenCms provides CmsEditorChangeHandlerProperty as concrete handler implementation.

Available editor change handlers

If in some observed editor field a new VFS link is inserted, the handler reads a specified property of the resource it is linked to and places this property as value into another editor field.

Writing your own editor change handlers

You are allowed to write your own editor change handlers. They have to implement the interface I_CmsXmlContentEditorChangeHandler located in the package org.opencms.xml.content. To simplify implementing new such handlers, the class A_CmsXmlContentEditorChangeHandler from the package org.opencms.ade.contenteditor can be used as base class.