Toggle menu

helper.utilExpandFieldVariableTemplate(template)

Takes a string and replaces any markers in it with the current value of a referenced field, variable or custom object.

Markers are in the form #FIELD# and %var% where FIELD is the name of a field and var the name of a form variable. You can also include custom tokens to use values from an object supplied with the template.

Arguments

ArgumentTypeDescription
templateString, requiredThe template text

Returns

String

Example

Where MYVAR is an object set in a form variable and YOURNAME the value of a text field.

function(helper, defaultValue, currentValue) {
    var theValue = helper.utilExpandFieldVariableTemplate("Variable value = %MYVAR%, Field Value = #YOURNAME#, Custom Value = #CUSTOMVALUE#, Another value = #SOMEOTHERVALUE#", {
        "CUSTOMVALUE": "My custom value",
        "SOMEOTHERVALUE": "Another thing"
    });
    return theValue;
}

Would return:

Variable value = {"name": "value"}, Field Value = John Smith, Custom Value = My custom value, Another value = Another thing

Share this page

Facebook icon Twitter icon email icon

Print

print icon