Start page / Template development / Rules / Form properties <PROPERTY/> / Property SECTION

SECTION property

Check to determine whether a section has been selected

The FS_REFERENCE input component can be used to incorporate any reference. When a page, page reference, or global page with at least one section is selected, a selection list appears so that a specific section can be selected. In this way, anchor links (for more information on “anchors”, see also chapter Link templates) can be included on web pages.

You can use the SECTION property to check whether a section has been selected: The <PROPERTY name="SECTION" source="gadget"/> expression can be used in the value determination area of the rule definition and in conjunction

  • with <NULL/> it returns FALSE if no section is selected; otherwise, it returns TRUE
  • with <NOT_NULL/> it returns TRUE if no section is selected; otherwise, it returns FALSE

If no section can be selected (for example, if sections="no" has been defined, the selected reference is a page reference without any sections, of if the selected FirstSpirit element type does not allow sections to be selected), the following warning is displayed on the Java Console:

WARN  10.03.2015 11:04:20.675 (de.espirit.firstspirit.forms.rules.Rule): The element 'gadget' does not support a property named 'SECTION'!

Example 1) Displaying a message if no section has been selected

Rules SECTION property

The example below illustrates a check to determine whether a section has been selected in an FS_REFERENCE component (“st_link” identifier). If no section has been selected, the following message is to be displayed: “You can select a section additionally”.

<RULES>
<RULE>
<WITH>
<NOT_ NULL>
<PROPERTY name="SECTION" source="st_link"/>
</NOT_NULL>
</WITH>
<DO>
<VALIDATION scope="RELEASE">
<PROPERTY name="VALID" source="st_link"/>
<MESSAGE lang="DE" text="Sie können zusätzlich einen Absatz auswählen"/>
<MESSAGE lang="*" text="You can select a section additionally"/>
</VALIDATION>
</DO>
</RULE>
</RULES>

Example 2) Displaying a message if a section has been selected

To display a message if a section has been selected, you can perform a NULL check instead of a NOT NULL check:

<RULES>
<RULE>
<WITH>
<NULL>
<PROPERTY name="SECTION" source="st_link"/>
</NULL>
</WITH>
<DO>
<VALIDATION scope="RELEASE">
<PROPERTY name="VALID" source="st_link"/>
<MESSAGE lang="DE" text="Absatz ausgewählt"/>
<MESSAGE lang="*" text="Section selected"/>
</VALIDATION>
</DO>
</RULE>
</RULES>

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.13 | Data privacy