Custom date validation help needed | XM Community
Solved

Custom date validation help needed

  • 8 December 2017
  • 4 replies
  • 204 views

Userlevel 5
Badge +10
Can anyone help out with RegEx for custom date validation. I want ensure it is a valid date AND after 01/01/2018. Qualtrics support recommended setting up as a form, but that seems a bit cumbersome. I'd like to have the XX/XX/XXXX format.
icon

Best answer by rettweber 12 December 2017, 20:46

View original

4 replies

Userlevel 3
Badge +6
Hi JulieT,

I know this is not an answer about Regex, but there are 3 date survey questions in the Qualtrics survey library under the demographics survey section. It may be possible to set the date range using the second and third date type. I need to learn more about regex and may play with this tonight with a Regex answer for you.

Rett
Userlevel 5
Badge +10
Thanks @rettweber I forget about Qualtrics libraries. I'm playing around with with two and three. Looks like I can set the date range. Thank you!
Userlevel 3
Badge +6
It is still worth some time for me to work out the regex, so I will give it a try tonight. I'll let you know what I figure out. Unfortunately reading regex can be a bit like reading hieroglyphics, so I will include an explanation for all of the setup.
Userlevel 3
Badge +6
Hi @JulieT ,

I know you found the date question, but I thought I would followup on the regular expression line.

I looked into the regex and there are a few sites that describe how to set regex for dates (ie https://regular-expressions.info/dates.html. There was also a nice discussion here (https://stackoverflow.com/questions/15491894/regex-to-validate-date-format-dd-mm-yyyy). You also have to rely upon regular expressions as they are interpreted in Javascript. There are slightly different flavors for different programming languages.

The advice across the different comment streams that I found (in programming forums, not specific to Qualtrics) was to use Javascript for validating the date rather than regular expressions. There are specific functions for dates in Javascript that you could use. Obviously, using the Qualtrics validation options is the first choice if possible, but then it looks like you really need to take a look at using Javascript.

Good Luck!!

Rett

Leave a Reply