There’re several different ways to handle Date values through the script, all depends on the exact need. In some cases, there’s a need to enter a date value manually, as text, yet to force it to be in a specific valid date format.
This article will show an example of how you can validate the date string format “DD/MM/YYYY” using a regular expression (to learn more on regular expressions, click here).
1. Step 1: Create an open ended question to hold the Date string format
2. Step 2: Add a validation rule for the format checking
Step 1: Create an open ended question to hold the Date string format
Add an open ended question to the script, where you want the Date value to be entered:
Step 2: Add a validation rule for the format checking
The Regular Expression that matches the format of DD/MM/YYYY is:
** Note: The regular expression above matches date formats that refer only to the years range of 1000 – 2999
So, you can add this validation rule to the question:
And add the suitable error message as you wish, such as: “The date entered is not in the right format of DD/MM/YYYY. Please fix.”
** If you’re not familiar to validation rules, please click here to learn more.
Visit us at: http://www.dooblo.net
Please sign in to leave a comment.