Skip to main content

insertVariable

Variable insert action function. This function can be used to enable the variable insert action on text input controls. This enables input controls to reference variables available in the form using an action key (for example, when pressing the @-key inside the control).

Signature

insertVariable(
target: Node | NodeBlock | Condition | ConditionBlock | Collection.Item,
mode?: "all" | "validated" | "exclude",
fnModifier?: (options: MenuOption[], done: (text?: string) => void) => MenuOption[]
): (done: (text string) => void, element: Element) => (() => "capture" | "cancel" | "continue") | undefined

Parameters

NameTypeOptionalDescription
targetNode | NodeBlock | Condition | ConditionBlock | Collection.ItemNoReference to the parent element.
mode"all" | "validated" | "exclude"YesSpecifies the slots to include. It can be one of the following values:
- all: Include all slots in the form;
- validated: Only include slots that are available for the target (basically these are all the slots prepending the supplied target);
- exclude: Include all slots but ignore the slots that are attached to the target.
fnModifier(options: MenuOption[], done: (text?: string) => void) => MenuOption[]YesSpecifies an optional modifier function that can be used to modify the generated menu with variables.

Return value

Returns a complex 😜 action function that is used by the text input controls.