Skip to main content
Version: 18

Questions

Questions are the basic building blocks of form definitions. To avoid having to duplicate questions, this separate library allows you to reuse the same question in multiple form definitions.

Answer types​

Various answer types are supported to ensure users can provide the necessary information in a structured way.

AnswerTypeDocumentation
TEXTTextual input (single line)
TEXT_AREATextual input (multiple lines)
RICH_TEXTRich text input with formatting options (bold, italic, underline, numbers list and bullet list)
NUMBERNumeric input
DATECalendar input
PHONEPhone input
SINGLESELECTRadio buttons: choices can be configured on the question
MULTIPLESELECTCheckboxes: choices can be configured on the question
SINGLEDROPDOWNDropdown: choices can be configured on the question (use AUTOCOMPLETE when you have a lot of choice)
AUTOCOMPLETEAutocomplete dropdown (elements are fetched from a list)
MULTI_AUTOCOMPLETEAutocomplete dropdown where multiple elements can be selected (elements are fetched from a list)
BOOLEAN_RADIOBoolean answer (textual yes/no options with radio buttons)
BOOLEAN_TOGGLEBoolean answer (displayed as a toggle button)
BOOLEAN_CHECKBOXBoolean answer (displayed as a checkbox)
COUNTRYCountry component with a fixed list of countries.
MULTI_COUNTRYCountry component with a fixed list of countries that allows selecting multiple values.

Depending on the selected answer type, additional configuration options may be available. For example, for TEXT, an answer validation field can be configured to require that the answer is a valid email address. For DATE, it's possible to configure that the date must be in the past or future. Explore the question configuration in the admin UI to see the available options for each answer type.

warning

Migration needed when switching between TEXT_AREA and RICH_TEXT!

Rich text editor values are saved with html formatting in the database. This means it is not straightforward to switch between a text-area and the rich text editor. The migration below can be used if you want to switch some_table.some_field from text-area to the editor. The migration encodes <, > and & and replaces new-lines by a proper html <br/>. Remember to migrate the _archive table if relevant.

The final not like '<p>%' is to avoid migrating rows that already contain html. This query can only be executed once! Double execution would lead to a double encoding of & to &amp; to &amp;amp;.

UPDATE some_table
SET some_field = REPLACE(REPLACE(REPLACE(REPLACE(some_field, '&', '&amp;'),'<', '&lt;'),'>', '&gt;'), '\n', '<br/>')
WHERE
some_field IS NOT NULL
AND
(some_field LIKE '%&%' OR some_field LIKE '%<%' OR some_field LIKE '%>%' OR some_field LIKE '%\n%')
AND
some_field NOT LIKE '<p>%';

Required​

When a question is marked as required, the user must provide an answer before being able to submit the form. Depending on the answer type, the meaning of required may vary:

  • For TEXT, TEXT_AREA, RICH_TEXT, NUMBER, PHONE, and DATE, the user must provide a non-empty value.
  • For SINGLESELECT, MULTIPLESELECT, SINGLEDROPDOWN, AUTOCOMPLETE, MULTI_AUTOCOMPLETE, COUNTRY, and MULTI_COUNTRY, the user must select at least one option.
  • For BOOLEAN_RADIO, the user must select either Yes or No.
  • For BOOLEAN_TOGGLE and BOOLEAN_CHECKBOX, the user must interact with the checkbox or toggle. This might change in the future.