Validating the number of options chosen in select many fields is useful to ensure the correct number of options are selected. This will allow you to specify the minimum and/or maximum number of options that can be selected during data collection.
For example, you may want to ensure that the respondent selects the required number of options.
- Add a select field with response options and choose the "Select many" response format.
- Open the validation tab of the field and select to configure validation rules if none have been applied yet.
- Choose whether the response must meet "All" or "Any" of the validating criteria.
- Select the validation operator, for example "number of options selected is equal to"
- Add the condition that must be validated against. For example 3.
- Add an optional error message to display if the response is not valid. For example, if more or less than three options are selected the response will not be valid and the error message will display "Select 3 sources of income"
By using field references you can validate the response against a previous field in your form.
For example, you may want to ensure that the number of options selected match the number indicated in a previous field.
- Follow steps 1 - 3 to add validation to your select field as outlined above.
- Select the relevant validation operator, for example "number of options selected is equal to".
- Reference the field that the response must be validated against. For example $Number_countries.
- Add an optional error message to display if the response is not valid.