This field creates a server-side variable of key-value pairs that can be looked up by form functions. Display values can be looked up using the .getOptionVariableDisplayValue function.
Properties
Label | Description | Type Name |
---|---|---|
Variable Name | The name of the variable. If no name is specified the field name will be used | VARNAME |
Lookup Options | The key-value pairs that will be stored in the variable. Use the popup editor to set the Value and Display values for each option. These values may be hard-coded (fixed) or dynamically loaded from a datasource. Hard-coded values can be entered using the grid provided on the "Fixed" tab of the popup editor. Alternatively, they can be supplied as comma-separated values (value,display) via the "Fixed (CSV)" tab, with each row representing a single option. Dynamically loaded values are set via the "Datasource" tab of the popup editor. The datasource must already be defined - see Using External Datasources. Typically, specifying the table, value, display and order by column names in the boxes provided will generate a suitable query. A custom query can be entered by expanding the "Advanced" section; it will use any names set in the above boxes to generate a starting query. This custom query should set the value into a "DataValue" column, and the display value into a "DataDisplay" column. For example: SELECT ValueColName as DataValue, DisplayColName as DataDisplay FROM TableName ORDER BY OrderByColName ASC | OPTIONS |
Lookup Options Function | A server-side JavaScript function that can manipulate or generate the options at the time the field is generated. This function will be executed server-side only. It is supplied the current Lookup Options as the For example the following will replace any fixed or database query options with 10 numbered options: function (helper, optionData) { | OPTIONSFUNC |
Documentation | Add documentation to your field to help explain any complex functionality to future users. You might include information on what the field does and how it relates to other fields on the form. Notes added here are only ever visible in the Forms Designer, they can be searched for, viewed and downloaded from the action panel. See Common Field Properties for an example | DOCUMENTATION |
Example
Setting the following fixed options:
Creates a form variable with the following value:
[
["1", "one", ""],
["2", "two", ""],
["3", "three", ""]
]
Last modified on August 18, 2022