Render template

An element which renders one of the plugin’s templates in the form or document, used to include explanatory notes in forms.

Properties

type "render-template"
template Name of the plugin’s template
view (optional) Arbitrary data passed to template’s render() function
plugin (optional) Name of another plugin from which to retrieve the template. Start the name with public/

Use the inForm and inDocument common properties to control where the template is rendered.

Use the plugin property to enable a plugin to provide templates to other plugins to implement generic functionality in forms. These templates should be within template/public to clearly identify them as templates provided to other plugins.

Template rendering

The template is rendered with a view containing the properties:

view The view from the specification.
context The current context within the document (ie root of the document, current section, or element in repeating section).
externalData The external data that was set with the externalData() function on the FormInstance.

Example

The specification:

{
    "type": "render-template",
    "template": "forms/special-note",
    "inDocument": false,
    "view": {
        "text": "This is a note"
    }
}

will render the "forms/special-note" template in the editable form, but not when rendered as a document. The template might look like:

<div class="special-note">
  view.text
</div>