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


Checks in which element type a form was opened

Forms, and thus also rules, can be used on different element types in FirstSpirit (pages, page references, folders, etc.).

The element type where a form is edited can be tested using a rule. For instance, a rule can be defined using the ELEMENTTYPE attribute that enables a form element to be displayed or edited, depending on the element type where the form is opened. This makes it possible to display or hide form elements (or even block them from being edited) directly that are opened on a certain element type.

The expression <PROPERTY source='#global' name='ELEMENTTYPE'/> can be used in the value determination area (or for the definition of a precondition), and checks on which element type a form was opened. Since this is a generally applicable form property, the source attribute has to be assigned the system object #global. The expression returns the designation of the element type where the content editor opened the form. The returned value corresponds to the type name (name of the interface in the API) in lowercase:

  • pagestoreroot
  • pagefolder
  • page
  • section
  • sectionreference
  • mediastoreroot
  • mediafolder
  • file
  • picture
  • sitestoreroot
  • pagereffolder
  • pageref
  • globalcontentarea
  • gcapage

In addition to defining a complete condition for element type-dependent validation, for example:

  • “Was the form opened on a page in the page store?” or
  • “Was the metadata form opened on an image or a file?”

This information includes a constant textual comparison value (for example, <TEXT>page</TEXT>) and the operator <EQUAL/>. In this case, the expression returns a Boolean value.


A form element is only to be displayed when it is opened on a picture type element

The following (metadata) form contains a CMS_GROUP type design element with different form contents for entry of EXIF data, resolutions, copyright information. A dynamic form is to be used to ensure that these elements are displayed only when opening the (metadata) form on a medium (image); however, they should be hidden on all other element types.

The expression <PROPERTY source="#global" name="ELEMENTTYPE"/> is used in the value determination area for this purpose. The <PROPERTY/> tag returns the type of element on which the form can be opened. This value is checked against a constant comparison value. The result of this check is a Boolean value, which then is linked to a handling instruction in the <DO/> section. As long as the condition is met (element type is equal to “picture”), the form content “st_metamedia” is made “visible” via an additional <PROPERTY/> tag in the handling instruction.

<PROPERTY source="#global" name="ELEMENTTYPE"/>
<PROPERTY source="#form.st_metamedia" name="VISIBLE"/>

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