BODY property
Checking in which content area a form was opened
Depending on the page layout, page templates can have multiple content areas (e.g. “left”, “center”, “right”). For each content area, the template developer can define the section templates that are permitted for use for this area (e.g. the section template “Text/Image” can only be used in the “center” content area).
The BODY attribute can be used to define a rule that makes it possible to display a form element from a section template, depending on the content area in which the form is opened. This also makes it possible to intentionally show or hide form elements within a certain content area.
The expression <PROPERTY source='#global' name='BODY'/> can be used in the value determination area of the rule definition (or for the definition of a precondition) and returns the name of the content area in which a form has been opened. Since this is a generally applicable form property, the object #global has to be assigned to the source attribute.
For defining a complete condition (e.g. “Was the form opened in the “center” content area?”), a constant text comparison value (e.g., <TEXT>center</TEXT>) and the <EQUAL/> operator must also be specified. In this case, the expression returns a Boolean value.
The expression can be used exclusively for defining rules within section templates. Outside the section templates, an error message will appear (“No such fact”). |
When used with type FS_LIST input components, the following applies:
Internal sections prepared autonomously determine the context element themselves from which the BODY property is derived. (This currently only applies to data records that do not have any content area and thus no BODY property can be derived for them.)
All other internal sections receive the external context element and thus “inherit” the BODY property (see example 2: Hiding input components in internal forms (FS_LIST)).
Examples
1) Intentionally hiding input components in different content areas
The page template in this example has the content areas “content_a”, “content_b” and “content_c”. The section template, which can be used within this page template, contains the following input components:
“Text_A”: should only be visible in the “content_a” content area.
“Text_B”: should only be visible in the “content_b” content area.
“Text_C”: should only be visible in the “content_c” content area.
“Text_AB”: should only be visible in the “content_a” and “content_b” content areas.
Since the value of the property does not change while the form is viewed, it is possible to work here by defining a precondition. This means that the subsequent rule is only carried out when the condition (e.g. content area corresponds to “content_a”) applies.
In the example, the components “Text_B” and “Text_C” are then initially hidden when the condition is fulfilled, which means the containing content area is called “content_a”. Value determination always returns <FALSE/> in this case and the handling instruction (“Show input components Text_B and Text_C”) is never executed. Thus in the “content_a” content area, only the input components “Text_A” and “Text_AB” are always displayed.
...
<ON_EVENT>
<IF>
<EQUAL>
<PROPERTY source="#global" name="body"/>
<TEXT>content_a</TEXT>
</EQUAL>
</IF>
<WITH>
<FALSE/>
</WITH>
<DO>
<PROPERTY source="Text_B" name="VISIBLE"/>
<PROPERTY source="Text_C" name="VISIBLE"/>
</DO>
</ON_EVENT>
...
The complete rule for all content areas is as follows:
<RULES>
<!-- content_A -->
<ON_EVENT>
<IF>
<EQUAL>
<PROPERTY source="#global" name="body"/>
<TEXT>content_a</TEXT>
</EQUAL>
</IF>
<WITH>
<FALSE/>
</WITH>
<DO>
<PROPERTY source="Text_B" name="VISIBLE"/>
<PROPERTY source="Text_C" name="VISIBLE"/>
</DO>
</ON_EVENT>
<!-- content_B -->
<ON_EVENT>
<IF>
<EQUAL>
<PROPERTY source="#global" name="body"/>
<TEXT>content_b</TEXT>
</EQUAL>
</IF>
<WITH>
<FALSE/>
</WITH>
<DO>
<PROPERTY source="Text_A" name="VISIBLE"/>
<PROPERTY source="Text_C" name="VISIBLE"/>
</DO>
</ON_EVENT>
<!-- content_C -->
<ON_EVENT>
<IF>
<EQUAL>
<PROPERTY source="#global" name="body"/>
<TEXT>content_c</TEXT>
</EQUAL>
</IF>
<WITH>
<FALSE/>
</WITH>
<DO>
<PROPERTY source="Text_A" name="VISIBLE"/>
<PROPERTY source="Text_B" name="VISIBLE"/>
<PROPERTY source="Text_AB" name="VISIBLE"/>
</DO>
</ON_EVENT>
</RULES>
2) Hiding input components in internal forms (FS_LIST)
If the section template mentioned above is used inside an FS_LIST, the internal FS_LIST sections also inherit the external BODY property. This means that the BODY property can be evaluated when editing the internal FS_LIST section (opening the internal section form). The rules defined in the internal section template thus also apply in this case. The figure shows an example of the forms within the “content_A” content area.
For information on the description and rule definition, see example 1: “Intentionally hiding input components in different content areas”.