Control How a Form Layout is Rendered

You can apply a form template to layouts to control how it's rendered, including which fields you want the layout to contain and how they are displayed in the layout.

For example, you might have a page that uses a dynamic form (not table) to display a detail view that includes sales figures, and you want the form to always display a Rating Gauge component, regardless of which fields are defined in the layout. You could create a 'Sales' form template that includes the Rating Gauge component, and then apply the template to the form. You can re-use the template in other dynamic forms in the layout's rule sets, but templates can't be shared between rule sets in different layouts.

To create a form template for a dynamic form:

  1. Open the layout's Templates tab.

    The Templates tab displays a list of field and form templates that are already defined for the artifact.

    Tip:

    If you've already created a form layout and want to create a template for it, you can open the layout in the rule set editor, click Use Template, and then select Create a New Template in the Use Layout Template window.
  2. Click + Template. Select Form, specify the Label (the ID is generated for you), and click Create.


    The form template opens in the template editor, which contains a Components palette, Structure view, canvas, and a Properties pane.

    In this image, you can see that the canvas has two read-only template sections that are generated automatically: Additional Fields and Remaining Required Fields. These fields are used to display the data and display names for the fields defined in the layout. These template fields render all the fields in the layout, so you don't need to modify the template each time you change a layout.
    Description of template-form-editor.png follows
    Description of the illustration template-form-editor.png

  3. In the Form Template's Properties pane, click + Add item under Extra and select a field. Extra fields are defined in the template, not in the layout. You will want to add a field as an Extra field when you know it will be needed by the layout. Each field you add in the Extra section can be used in the form and will always be available when the template is applied.

    Each Extra field must be mapped to a component if you want it to appear in the form. This image shows the Properties pane after the certifications field has been added to the template as an Extra.
    Description of template-form-extra.png follows
    Description of the illustration template-form-extra.png

  4. Drag the component you want to add from the Components palette and position it in the Structure view or on the canvas.


    You can add components above and below the read-only template fields, but not within them. In the Structure view of this template, you can see an Input Text component that was positioned above the Additional Fields template in the Form Layout.



  5. While the component is selected on the canvas or in the Structure view, open the component's Data tab in the Properties pane and bind the component to the Extra reference field.

    To help you select the reference field, you can click fx iconto open the Expression Editor, or Select Variable to open the Variables picker.
    Description of template-form-component-bind.png follows
    Description of the illustration template-form-component-bind.png

    To write efficient expressions that handle situations where a referenced field might not be available or the field's value could be null, see How Do I Write Expressions If a Referenced Field Might Not Be Available Or Its Value Could Be Null?

After you've added the components and fields to your form template, you can apply the template when you edit a layout in the Rule Sets editor.