Takes a string and replaces any markers in it with the current value of a referenced field or variable. Also escapes JSON.
Markers are in the form
Any JSON supplied to the template will be escaped.
Repeating Pages
If the field you want to display the value of is on a repeating page, include the page instance in square brackets between the hash symbols, like this
The following tokens can also be used:
#PAGEINSTANCE# - The page instance that's currently being displayed (zero-based, ie the first instance is 0)#PAGEINSTANCEDISPLAY# - The user friendly current page instance (one-based, ie the first instance is 1)#PAGEINSTANCEMIN# - The minimum number of instances set in the forms designer#PAGEINSTANCEMAX# - The maximum number of instances set in the forms designer#PAGEINSTANCECOUNT# - The current number of instances (of this page) that have been generated
Arguments
Argument | Type | Description |
---|---|---|
template | String, required | The template text |
Returns
A JSON escaped string.
Example
The following function has been added to the first text input box, called
function (helper, fieldName, value, valid, eventName) {
if (eventName == 'CHANGE') {
var msg = helper.utilExpandJSONTemplate('#FIELD#, %myVar%');
helper.setFieldValue('MESSAGE', msg);
}
}
Enter