@PICK_ONE_QUESTION
Specifies that a variable will be a value out of a list of choices.
Before generating a document, DocuMold will display a dropdown to choose the value.
Usage
Parameters
variable |
(Required) The variable this applies to. Do not use double quotes ( |
choices: |
(Named, Required) The choices to display. Can be a list of values, a list of list of two values, or a DT_CHOICES. See “More information” below. |
example_value: |
(Named) The initial value in the form when preparing a template (via “Prepare a template”). If not given, the value of |
help_text: |
(Named) Displays a clickable (?) bubble beside the label. Clicking it will reveal this text. Useful to give directions to the user of the DocuMold template. |
initial_value: |
(Named) The initial value in the form when using a template (via “Use a template”). This is also the default value of the |
label: |
(Named) The text to display beside the dropdown box that asks for the value. Defaults to variable’s name. |
optional: |
(Named) Set this to |
placeholder: |
(Named) If specified, this is the text in the dropdown box when nothing is selected. Default is “Pick one” |
Parameters with “Named” mean that you must specify the name of the parameter and a colon before its value.
Ex: choices: "its value"
Examples
More information
This action does nothing to the document itself; it gets erased when generating a document.
The choices can be:
- A list of values: each value will be displayed as a choice, and that’s the value the variable will have.
- A list of list of 2 values: Basically a list of pairs. For each pair, the first value is the text to display
in the dropdown and the second value is the one the variable will have when this is selected.
So
[["By name", "name"], ["By age", "age"]]
means the choices areBy name
andBy age
, and the variable will be set to either"name"
or"age"
. This is useful to provide a clearer choice to the user, without having to write the longer text everywhere. Values can be non-text, such as numbers, dates, etc. DT_CHOICES
is a function that allows getting choices from a data table. SeeDT_CHOICES
for more details.
If no value is selected in the form for this question, the variable will be set to NOTHING
.
All @..._QUESTION
actions are normally placed at the end of the template to avoid overwhelming unfamiliar users.
The @IF
action has no effect on the @...QUESTION
actions. The @...QUESTION
actions have an effect even when they is hidden.