Custom Numeric Validation | XM Community
Solved

Custom Numeric Validation

  • 22 October 2018
  • 6 replies
  • 310 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!!
icon

Best answer by NiC 22 October 2018, 23:24

View original

6 replies

Userlevel 7
Badge +27
hi @ecw2144
You can use custom validation where the text entry matches with the following regex:
^\\d+\\.\\d\\d$
Hope this helps 🙂
Userlevel 7
Badge +27
> @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}$
```
Userlevel 7
Badge +27
> @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 🙂
Userlevel 7
Badge +27
> @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.
Thank you @NiC and @TomG -- I was able to get it to work as needed! 😀
Badge
> @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!

Leave a Reply