Date validation options | XM Community
Skip to main content
Hi all,

Is there an EASY way to enter an acceptable date range for the following scenarios:

1. Participants must be over 18 - so their date of birth entered should fall before: today's date minus 18 years

2. Participants child must be between 2 weeks and 12 months old - so their baby's dob should fall between: today's date minus 2 weeks and today's date minus 52 weeks



If the dates entered do not fall between the validation dates I would like an error message to appear saying "Please check the dates entered. Please note you must be over 18 with an infant aged 2 weeks to 12 months to participate in this study."



Having no knowledge of how to write JS, how might I do that? I would have thought it would be a standard function however the validation only seems to allow for the format of the date, not a range. I've looked at the library and can't see that there's an option there but please correct me if I'm wrong. Also, I've looked at custom validation and can't see that entering a range is possible there either?
I think your best bet here is not to use validation (use that to validate the date format) but instead use embedded data and math operations with branching logic. Check out this thread on how to do this here:



https://www.qualtrics.com/community/discussion/660/how-do-i-subtract-between-two-dates-in-a-survey



One of the benefits of using the branching logic is you'll be able to tell how many people wanted to take your survey but didn't qualify versus how many just exited.

Leave a Reply