Validation check
Last updated
Was this helpful?
Last updated
Was this helpful?
To enable advanced validation checks in answer options for your multiple choice question, import the library as described in the Getting started section.
Once you have completed the main steps, you will need to modify the parameters in the provided template snippet to apply the changes.
question_code
The code of the single choice question you want to configure
schema
This variable represents an open text field where answer codes will be stored. It is only required if you plan to use this question to filter or randomize in the same order. Remove it if not needed.
π‘ Use a descriptive name for the schema that indicates it is associated with a specific question code, such as Q1_SCHEMA
or Q1xSCHEMA
βΉοΈ Te open text should be placed in the same page of the multiple choice.
validation
This section defines the settings for validating the selected options.
You can delete this code block and skip this tutorial if you donβt need validation. π
validation
-> n_required
This variable lets you set a required number of options to be selected.
If the user selects fewer than n_required options, an error message will be displayed. If the user selects exactly n_required options, any remaining options will be disabled.
π‘Use this variable when you need an exact number of selected options. βΉοΈ You cannot use this variable together with min_limit and/or max_limit.
validation
-> min_limit
This variable lets you set a minimum number of options to be selected.
If the user selects less than min_limit options, an error message will be displayed.
π‘You can use this variable alone or together with max_limit to limit the range of selected options.
βΉοΈ You cannot use this variable together with n_required.
validation
-> max_limit
This variable lets you set a maximum number of options to be selected.
If the user reaches the max_limit of selected options, any remaining options will be disabled.
π‘You can use this variable alone or together with min_limit to limit the range of selected options. βΉοΈ You cannot use this variable together with n_required.