You can set up dependencies between editors in the same cartridge such that the behavior of one editor is dependent upon a property that is bound to another editor in the cartridge.

In a typical editor definition you can specify whether the editor is enabled via the enabled attribute. Editors are enabled by default. You can disable the editor by setting the value of enabled to false as follows:

<StringEditor propertyName="moreLinkText" label="Title" enabled="false"/>

In this case, the value of the associated property (in this case, moreLinkText) displays in the Content Details Panel but cannot be updated by the user.

The enabled status of an editor can be updated dynamically based on the value of another property by replacing the literal value of the enabled attribute (either true or false) with an expression that is evaluated to determine the editor's behavior. For example:

<StringEditor propertyName="moreLinkText" label="Title" enabled="{showMoreLink == true}"/>

In this case, the string editor that enables editing of the text for the "More" link is not enabled unless the property showMoreLink (which is bound to another editor) is set to true. This kind of dependency enables you to assemble complex editing interfaces out of simple property editors, without writing custom editors that contain the dependency logic.

The value of an attribute is treated as an expression if it is contained within {curly braces}, otherwise it is treated as a literal value.

There is no validation for editor dependency expressions within a template, however, if an expression contains syntax errors, an InvalidExpressionError is thrown upon initialization of the editor. Currently, the only attribute for which expressions are evaluated is the enabled attribute.

Because the editor dependency expressions are embedded in XML, it is important to apply the appropriate escaping to special characters within expressions.

The editor dependency language supports two different ways to escape special characters.

In some cases, when an editor is dynamically enabled based on the value of another property, you want to ensure that the associated property has a specific value when the editor is disabled.

Specifying a "disabled value" for an editor ensures that whenever the enabled expression evaluates to false (that is, the editor is dynamically disabled), the associated property is set to the specified value. This can be useful in the case where the value of the property associated with the editor should be set to a default value whenever the editor is disabled.

The disabled value for an editor is optional. If no value is specified and an editor is disabled, then its property retains its most recently set value (whether this was originally a default value or specified by the content administrator in Experience Manager). The content administrator cannot update the value while the editor is disabled, but it preserves the latest setting in the case that the content administrator re-enables the editor at a later point.

To specify a default value for an editor:

The following example shows a radio group editor configured with a disabled value.

<ContentTemplate xmlns="http://endeca.com/schema/content-template/2008"
                 xmlns:xavia="http://endeca.com/schema/xavia/2010"
                 xmlns:editors="editors"
                 type="SidebarItem" id="FlatDimension">
    <!-- additional elements deleted from this example -->
    <ContentItem>
        <Name>New Text Link Flat Dimension</Name>
        <!-- additional elements deleted from this example -->
        <Property name="sort">
            <String>default</String>
        </Property>
        <Property name="showDisabledRefinements">
            <String>false</String>
        </Property>
        <!-- additional elements deleted from this example -->
    </ContentItem>
    <EditorPanel>
        <BasicContentItemEditor>
            <!-- additional elements deleted from this example -->
            <editors:ChoiceEditor label="Sorting Options" propertyName="sort">
                <choice label="Dimension default" value="default"/>
                <choice label="Alphanumeric" value="static"/>
                <choice label="By frequency" value="dynRank"/>
            </editors:ChoiceEditor>
            <editors:RadioGroupEditor propertyName="showDisabledRefinements"
                label="Show 'Disabled Refinements'" 
                enabled="{sort == 'static'}"
                disabledValue="false">
                    <choice label="Yes" value="true"/>
                    <choice label="No" value="false"/>
            </editors:RadioGroupEditor>
            <!-- additional elements deleted from this example -->
        </BasicContentItemEditor>
    </EditorPanel>
</ContentTemplate>

When the Content Details Panel is first instantiated, the selected value for the radio group editor is false, which displays with the label "No," and the editor is disabled, because the default value of the sort property is not equal to static. If the content administrator selects "Alphanumeric" from the choice editor, the radio group editor is enabled, and the content administrator can change the value of showDisabledRefinements to true. However, if the content administrator later selects a different value from the choice editor (either "Dimension default" or "By frequency"), the radio group editor is once again disabled and the value of showDisabledRefinements set to false.


Copyright © Legal Notices