Skip to main content

Fundamental Elements

This subsection consists of the commonly-used elements to change form behavior and appearance.

The elements/extensions that fall under this subsection are:

From Core Questionnaire

From SDC

Required

An indication, if true, that the item must be present in a "completed" QuestionnaireResponse. If false, the item may be skipped when answering the questionnaire.

Also appears in the Value Constraints subsection.

Basic Usage

Repeats

An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.

Basic Usage

Most question items with item.repeats = true are presented in this manner. An add and remove button is provided to manage additional instances of the item.

Checkbox Usage

If a question is a checkbox and item.repeats = true, a different view is presented. Instead of having add and remove buttons, multiple selections can be made in the checkbox.

tip

From a form design perspective, checkboxes are generally used if multiple answers are allowed to be selected. If only one answer is allowed, radio buttons should be used instead.

For more information, refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/radio.

Group Usage

Similar to the basic usage, a repeating group provides add and remove buttons to manage additional instances of the group item.

Nested Group Usage

You can nest repeating groups(or any other components, really) within another repeating group. This allows for a more complex form structure.

It is recommended to view this example in Storybook in full screen mode.

ReadOnly

An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.

It is generally used with calculations or pre-filled values.

Basic Usage

Initial

Allows one or more values to be pre-filled in the answer when initially rendering the questionnaire for user input. Initial values can't be specified for groups or display items.

Questions using answerOption can use answerOption.initialSelected as an alternative.

note

Multiple initial values can be used in repeating items. There can only be one initial value for non-repeating items.

Basic Usage

Repeats Usage

Hidden

Allows the item to be hidden from the user interface.

This is useful for answers to be captured behind the scenes via pre-fill and calculation mechanisms but are not intended to be displayed to the user. The output QuestionnaireResponse will still contain answers from hidden items.

Basic Usage