Toggle menu

helper.getOptionVariableDisplayValue(variableName, keyValue)

Returns the display value of the supplied key from a list of options stored in a form variable.

This function can be used to lookup the display value of a key-value pair in a variable created by the Form Variable - Lookup field, or the the <fieldname>_OPTIONDATA variables created by the Drop-down List, List Box, Checkbox Group, and Radio Button Group field types.

Executed

Client-side and server-side.

Arguments

ArgumentTypeDescription
variableNameString, requiredThe variable will be an array of arrays generated by the Form Variable - Lookup, or one of the list-type fields
keyString, requiredThe key (value) whose display value should be returned

Returns

The display value of the supplied key.

Example

Given the following variable:

myVariable = [
    ["1", "one"],
    ["2", "two"],
    ["3", "three"]
]

This function:

function (helper, defaultValue, currentValue) {
    var theValue = helper.getOptionVariableDisplayValue('myVariable', '2');
    return theValue;
}

Would return "two".

Last modified on September 13, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon