Number range validation for "allow text entry" text box | XM Community
Solved

Number range validation for "allow text entry" text box

  • 29 May 2019
  • 3 replies
  • 176 views

Badge +2
Hi I am looking to require numbers 0-30 only in a text entry box, in a multiple choice question.

I would use a text entry question type, but I need to have two other options available (refused, don't know).

I couldn't use custom validation (regex 0-30) because that required something be entered, when the respondent could select one of the other two options.

I guess more generally, how can I add radio choices (refused, don't know) to questions of other types (e.g. text entry, matrix, ect.)

!
icon

Best answer by Anonymous 29 May 2019, 21:11

View original

3 replies

Hello @OI899 ,

You can use regex, in custom validation you need to check if first option is selected then only check the regex
Badge +2
Thanks very much- can you help me with the regex code?

And to clarify- will I use regex code to indicate "if first option is selected, then check the regex"?
Try using below regex:

`\\b([1-9]|[12][0-9]|3[0])\\b`

will I use regex code to indicate "if first option is selected, then check the regex"? - No, you need to use

option 1 is not selected
OR
option 1 text entry matches regex.

Leave a Reply