Skip to content

Form Templates

Form templates provide reusable form elements, simplifying form creation and maintenance. Changes to a template automatically update all forms using it. Templates can contain any form element, including other templates (allowing for recursive use). Templates are defined within a process definition and can be used across multiple workflow pools.

Creating Form Templates

Creating a form template is similar to creating a standard form; however, the data model uses the <type> element instead of <element>. Adding a template to a form automatically generates the corresponding data model element.

Using Templates in Forms

To incorporate a template, add a new element to the form and select the desired template. This automatically creates a new data model element for the template.

Example Template Usage

1
2
3
4
<ApplyTemplate Name="MyTemplate" XPath="MyContainer">
    <Rules/>
    <Parameters/>
</ApplyTemplate>

Name: The name of the template to use. XPath: The XPath of the container element to bind the template to.

Rules and Validation

The <ApplyTemplate> widget supports validation and formatting rules, affecting content visibility and data validation. These rules also apply to elements within the template itself.

Parameters

Templates support parameters passed from the parent form. These parameters are accessed as variables (with a $ prefix) within XPath expressions and scripts. Variable names must adhere to XML naming conventions, and values must be static.

Example with Parameters:

1
2
3
4
5
6
<ApplyTemplate Name="MyTemplate" XPath="MyContainer">
    <Rules/>
    <Parameters>
        <MyVariable Type="System.String"><![CDATA[10]]></MyVariable>
    </Parameters>
</ApplyTemplate>

In this example, MyVariable is passed to the template with a value of "10". It can then be used within the template's XPath expressions (e.g., Total > $MyVariable).