Validation of text entry in multiple choice questions | XM Community
Skip to main content
Solved

Validation of text entry in multiple choice questions


Hi,

Is there any way to set minimum character requirements for the text entry boxes (which show up if you select allow for text entry) in multiple choice questions? the options are quite different from a regular textbox question.

Best answer by bstrahin

I agree that having the box with the check option is much easier for the respondent. If you are only interested in that they don't leave the box blank, I would not use custom validation but rather the feature that Kate pointed out. This will be much more simple for you to program. You would choose to "force response" in her screen shot above.

This then allows all of the following scenarios:
* If the box is not checked, the text field can be left blank and advance
* If the box is not checked but there is text in the field Qualtrics automatically throws an error
* If the box is checked and the text field is empty, it will not advance until the respondent types something in the box.
View original

16 replies

  • Author
  • 5 replies
  • August 9, 2018
Thanks! How do you set minimum characters requirements? In a regular textbox, you will have an explicit option for that. I don't seem to find it here.

bstrahin
Level 6 ●●●●●●
Forum|alt.badge.img+38
  • Level 6 ●●●●●●
  • 638 replies
  • August 9, 2018
@hessam01 the minimum length is a built in validation for text entry question types. See screenshot. If this is very important to you, then you can have this show up as a follow-up question (display logic) to your your multiple choice question. If you just want to make sure they enter something (e.g. len > 0) then you can follow @Kate's screenshot and choose force response.

!

  • Author
  • 5 replies
  • August 9, 2018
Thanks for your response. I prefer to have the text beside the checkbox in the same question. I found the following option (see the screenshot) on custom validation. Do these apply to text values?

Thanks in advance!

!

bstrahin
Level 6 ●●●●●●
Forum|alt.badge.img+38
  • Level 6 ●●●●●●
  • 638 replies
  • Answer
  • August 9, 2018
I agree that having the box with the check option is much easier for the respondent. If you are only interested in that they don't leave the box blank, I would not use custom validation but rather the feature that Kate pointed out. This will be much more simple for you to program. You would choose to "force response" in her screen shot above.

This then allows all of the following scenarios:
* If the box is not checked, the text field can be left blank and advance
* If the box is not checked but there is text in the field Qualtrics automatically throws an error
* If the box is checked and the text field is empty, it will not advance until the respondent types something in the box.

  • 0 replies
  • August 9, 2018
Hello @hessam01 ,

Choose "Matches regex" from the custom validation option and in the last box paste the following code(without quotes): "[A-Za-z]{5}" where 5 is minimum character requirement

  • Author
  • 5 replies
  • August 9, 2018
Thanks bstrahin, Shashi, and Kate for your great help on this.

  • 0 replies
  • August 9, 2018
> @Shashi said:
> Hello @hessam01 ,
>
> Choose "Matches regex" from the custom validation option and in the last box paste the following code(without quotes): "[A-Za-z]{5}" where 5 is minimum character requirement

In case you want space, comma, dot, question mark, exclamation use this "[A-Za-z,.!? ]{5}"
customize accordingly.

  • Author
  • 5 replies
  • August 9, 2018
> @Shashi said:
> Hello @hessam01 ,
>
> Choose "Matches regex" from the custom validation option and in the last box paste the following code(without quotes): "[A-Za-z]{5}" where 5 is minimum character requirement

Thanks for your response! How can I do that for each of the textboxes. The custom validation works at the question level, not the option level. So basically, what I want to do is that if a respondent selects each of the idea boxes then he/she will be required to enter at least a 50 character description. This is the screenshot for your reference.

Thanks in advance!

!

  • 0 replies
  • August 9, 2018
> @hessam01 said:
> > @Shashi said:
> > Hello @hessam01 ,
> >
> > Choose "Matches regex" from the custom validation option and in the last box paste the following code(without quotes): "[A-Za-z]{5}" where 5 is minimum character requirement
>
> Thanks for your response! How can I do that for each of the textboxes. The custom validation works at the question level, not the option level. So basically, what I want to do is that if a respondent selects each of the idea boxes then he/she will be required to enter at least a 50 character description. This is the screenshot for your reference.
>
> Thanks in advance!
>
> !
>
>
>

Suppose you have 3 options then the conditions will be as shown in the image.
!

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5902 replies
  • August 9, 2018
The correct regex for any 50 characters or more is `^.{50,}$`

  • 0 replies
  • August 9, 2018
> @Shashi said:
> Hello @hessam01 ,
>
> Choose "Matches regex" from the custom validation option and in the last box paste the following code(without quotes): "[A-Za-z]{5}" where 5 is minimum character requirement

Thanks @TomG ,
The correct regex is "^[A-Za-z]{50,}$"

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5902 replies
  • August 9, 2018
> @Shashi said:
> > @Shashi said:
> > Hello @hessam01 ,
> >
> > Choose "Matches regex" from the custom validation option and in the last box paste the following code(without quotes): "[A-Za-z]{5}" where 5 is minimum character requirement
>
> Thanks @TomG ,
> The correct regex is "^[A-Za-z]{50,}$"

That will only allow letters (no spaces, punctuation, numbers, etc.). That probably isn't what @hessam01 wants. The regex I provided will allow for any characters.

  • Author
  • 5 replies
  • August 23, 2018
Hi all,

It is me again having a question. I tried the following code (to accommodate different types of characters but still receiving an error even when I put more than 50 characters in the boxes. It only works when I put alphabetical characters. Any solution?

^[A-Za-z,.! ?/:;'"@#$%^&*()1234567890{50,}$

This is the screenshot

!




Thanks!

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5902 replies
  • August 23, 2018
@hessam01,

Any of these special characters:
```
[\\^$.|?*+(){}
```
have to be escaped with a \\ in front of them.

Respondents aren't going to know what characters they can use and not use so, I think you would be better off just using the regex I gave earlier:
```
^.{50,}$
```

  • 1 reply
  • March 21, 2019
It seems like @Kate's comment has disappeared. Can someone re-post/re-explain it? I too would love to know how to simply force a respondent to enter text if they select an option which has a text entry next to it.

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5902 replies
  • March 21, 2019
> @ADGA said:
> It seems like @Kate's comment has disappeared. Can someone re-post/re-explain it? I too would love to know how to simply force a respondent to enter text if they select an option which has a text entry next to it.

Select force response from the menu attached to the answer option:
!

Leave a Reply