Toggle menu

helper.getVariable(name [, defaultValue])

Used to get the value of a helper variable.

A helper variable is used to store data within the form helper. Variables are saved with a scope (see .setVariable) which defines how they behave and where they can be accessed.

If multiple forms are rendered on the same page, they can have independent variables with the same name.

Executed

Client-side and server-side.

Arguments

ArgumentTypeDescription
nameString, requiredName of the variable to get
defaultValueString, optionalA default value if the variable cannot be accessed, or has no value

Returns

The value of the variable, undefined if the variable doesn't exist, or the default value if supplied.

Example

In this example the value of FIELD4 is being updated with the value of a variable called myVariable.

function (helper) {
    helper.setFieldValue('FIELD4', helper.getVariable('myVariable'));
}

Last modified on September 13, 2023

Share this page

Facebook icon Twitter icon email icon

Print

print icon