Toggle menu

HTML Template (browser-side)

This field lets you create a HTML template using Handlebars. The template can dynamically generate HTML by inserting the values of form fields, helper variables, and optionally, additional data supplied through this field's value (which can be set in the default function).

There's an example of this template being used in the Displaying Values and Variables knowledge base article.

Use this field with caution. It operates in the browser and all data supplied to the template by your default function will be present on the browser, even if it is not displayed by the template. The server-side version should generally be used in preference to this field.

Custom Functions

Custom functions can be called from the handlers of other fields using .invokeCustomFieldFn.

  • renderHTML - This will refresh the template, using the new values of any referenced fields or variables

Properties

LabelDescriptionType Name
SummaryA short description of what the field does, displayed in the forms designer to help identify itSUMMARY
TemplateThe Handlebars template. Handlebars templates look like regular HTML, with embedded handlebars expressions. There's more information in the Handlebars Editors articleTEMPLATE
DefaultDefault JSON data that will be supplied to the template. This is a JSON data object that may be used to replace {{name}} expressions within the template. It needs to be expressed as a string in the form: {"name" : "value", "anothername": "value"}DEFAULT
Update on ChangeWhether to perform a refresh of the template output if a field value changes. The default behaviour will refresh if any field on the current page is updated. The "Fields" property can be used to restrict refreshing to specific field changesUPDATEONCHANGE
FieldsList of fields that, if updated, will trigger a refresh of the template output. Separate the names of fields with commas. If this property contains an asterisk or an empty string it will refresh on all field changes.

The "Update on Change" property must be true
REFFIELDS
Default FunctionA JavaScript function you can use to calculate the starting field value. This function is executed server-side when the field HTML is generated. See Common Field Properties for an exampleDEFFUNC
Manipulation FunctionData Manipulation function that can manipulate the JSON data object supplied to the template. This function is executed browser-side before generating any HTML. It is supplied with two parameters, a reference to the helper library and the current value of the JSON object. The second parameter is always supplied as a JavaScript JSON object. It will never be null or undefinedCALCFUNCTION
Additional Styling ModifierAn optional CSS modifier for the field. See Common Field Properties for an exampleADDITIONALSTYLINGMODIFIER
DocumentationAdd documentation to your field to help explain any complex functionality to future users. You might include information on what the field does and how it relates to other fields on the form. Notes added here are only ever visible in the Forms Designer, they can be searched for, viewed and downloaded from the action panel. See Common Field Properties for an exampleDOCUMENTATION
Last modified on 08 July 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon