STORETYPE property
Store-dependent validation
FirstSpirit recognizes different stores. Rules can be used in all stores where FirstSpirit forms are used, both in SiteArchitect and in ContentCreator, for example in:
- Forms for the page store and content store
- Forms for maintaining metadata such as in the media store
- Forms for workflows, scripts and link templates in the template store
The store where a form is edited can be tested via a rule. For instance, a rule can be defined using the STORETYPE attribute that enables an input element to be edited or displayed, depending on the store where the form is opened.
The expression <PROPERTY source='#global' name='STORETYPE'/> can be used in the value determination area (or for the definition of a precondition), and checks in which store a form was opened. Since this is a generally applicable form property, the attribute source has to be assigned the object #global. The expression returns the designation of the store where the content editor opened the form:
- pagestore
- sitestore
- contentstore
- mediastore
- templatestore
Additional information has to be specified to define a complete condition for store-dependent validation, for example:
- “Was the form opened in the page store?” or
- “Was the form opened in a store that was not the page store?”
This information includes a constant textual comparison value (for example, <TEXT>pagestore</TEXT>) and the operator <EQUAL/>. In this case, the expression returns a Boolean value.
Examples
A form element is displayed only when opening the form in the page store
The following form contains a design element of type CMS_GROUP with different form contents. A dynamic form is to be used to ensure that these elements are displayed only when opening the form in the page store; in all other stores, however, they should be hidden.
The expression <PROPERTY source="#global" name="STORETYPE"/> is used in the value determination area for this purpose. The <PROPERTY/> tag returns the type of store in which the form can be edited. 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 (store type is equal to “pagestore”), the form content “st_pagestore” is made “visible” via an additional <PROPERTY/> tag in the handling instruction.
...
<ON_EVENT>
<WITH>
<EQUAL>
<PROPERTY source="#global" name="STORETYPE"/>
<TEXT>pagestore</TEXT>
</EQUAL>
</WITH>
<DO>
<PROPERTY source="#form.st_pagestore" name="VISIBLE"/>
</DO>
</ON_EVENT>
...