How to restrict a number question from 1 to 4?

I have a numerical control question that is limited from 1 to 4 only.

Hi @ENCDIGITAL,

You could do this by using a simple constraint or a regex code as outlined below.

In the survey tab of your xlsform:

Data entry screen as seen in Enketo: When a wrong entry is made

Data entry screen as seen in Enketo: When a correct entry is made

Reference xlsform:
Number Constraint.xlsx (9.7 KB)

If you wish to learn more on handling constraint, please feel free to have a look at our support article Limiting Responses with Validation Criteria. Similarly you could also have a look at our support article Restricting text responses with regular expressions to learn more about regex.

Have a great day!

1 Like