Select to view content in your preferred language

Restrict date values for 99-99-9999 body::esri:inputMask.

117
1
10-10-2024 12:02 PM
achs
by
Emerging Contributor

Hi! 
Mi users are filling out a date, to get an easier way to capture it, the field was set up like this 99-99-9999 as body::esri:inputMask. 

Analyzing the data I've found out that the users sometimes make mistakes, and registered mistmatched dates like 2220 instead of 2020, same thing at months and days. 

¿Is there a way to restrict allowed values? 

Like, 01 to 31 for 2 first digits, 01 to 12 for second pair of digits and 1900 to 2020 for las 4 digits. 

 

Thanks!

0 Kudos
1 Reply
ChristopherCounsell
MVP Regular Contributor

I'd do the following:

  • Make the question type Date (and use the field bindings if the field is something else like string)
  • Set the question appearance to help user input 
  • Add a constraint to enforce the desired date range

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformsappearance.htm#ESRI_SECTION1_FB9E...

The below blog has more on working with date and time in survey123. You'll want to look at the calculations for the constraint.

If you are trying to submit a string value you might need to set up a dummy user input question for date (null), then calculate the desired date format into the hidden actual string question.

https://community.esri.com/t5/arcgis-survey123-blog/dates-and-time-in-survey123/ba-p/895528

Let us know if this approach doesn't work for your workflow but personally I'd do this over regex and constraint masks...