Custom Numeric Validation | XM Community
Skip to main content
Solved

Custom Numeric Validation

  • October 22, 2018
  • 6 replies
  • 508 views

Hi, I am having participants estimate different amounts. I want their responses to be numerical and estimated to the second decimal point (e.g., 17.15). I cannot find a way to do this in Qualtrics with the existing options. For Content Validation I can specify numeric, a min, a max, and the max number of decimals (when really I want a min number of decimals). I maybe be able to achieve my goal via the Custom Validation with regex code. Can anyone help me with this? Thank you!!

Best answer by NiC

hi @ecw2144 You can use custom validation where the text entry matches with the following regex: ^\\d+\\.\\d\\d$ Hope this helps :)

6 replies

NiC
QPN Level 5 ●●●●●
Forum|alt.badge.img+27
  • QPN Level 5 ●●●●●
  • Answer
  • October 22, 2018
hi @ecw2144 You can use custom validation where the text entry matches with the following regex: ^\\d+\\.\\d\\d$ Hope this helps :)

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • October 22, 2018
> @NiC said: > hi @ecw2144 > You can use custom validation where the text entry matches with the following regex: > ^\\d+\\.\\d\\d$ > Hope this helps :) Except Qualtrics doesn't recognize shorthand character classes, so you have to do it like this: ``` ^[0-9]+.[0-9]{2}$ ```

NiC
QPN Level 5 ●●●●●
Forum|alt.badge.img+27
  • QPN Level 5 ●●●●●
  • October 22, 2018
> @TomG said: > > @NiC said: > > hi @ecw2144 > > You can use custom validation where the text entry matches with the following regex: > > ^\\d+\\.\\d\\d$ > > Hope this helps :) > > Except Qualtrics doesn't recognize shorthand character classes, so you have to do it like this: > ``` > ^[0-9]+.[0-9]{2}$ > ``` > It works i tried it before suggesting it :)

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • October 22, 2018
> @NiC said: > > @TomG said: > > > @NiC said: > > > hi @ecw2144 > > > You can use custom validation where the text entry matches with the following regex: > > > ^\\d+\\.\\d\\d$ > > > Hope this helps :) > > > > Except Qualtrics doesn't recognize shorthand character classes, so you have to do it like this: > > ``` > > ^[0-9]+.[0-9]{2}$ > > ``` > > > > It works i tried it before suggesting it :) If it does, it must be something new. It has never recognized them before.

  • Author
  • October 22, 2018
Thank you @NiC and @TomG -- I was able to get it to work as needed! 😀

Forum|alt.badge.img+3
  • Level 1 ●
  • October 4, 2019
> @ecw2144 said: > > For Content Validation I can specify numeric, a min, a max, and the max number of decimals (when really I want a min number of decimals). Hi ecw2144, I was searching for my questions about setting decimal places in my custom validation when I came across your post. I believe you know the answer to my question. Can you please tell me how to specify the max number of decimals for a numeric entry? I was able to specify the max and min of the range, but couldn't figure out about the decimals. Thank you!