Select to view content in your preferred language

Ability to validate date entered

215
1
04-08-2024 03:42 PM
CESPEDESLUISITD
New Contributor III

Hello everyone, I am having a hard time trying to validate dates entered for inspections. Some users try to enter a date in the past, rather than today's date. I need to enforce that they can only use today's date in the required date field. 

I tried to do the Arcade thing, but it disables the editing ability. 

Is there any way to validate date or other field before users submit?

PS- something like a *required field, but for validation

Thanks

0 Kudos
1 Reply
KerriRasmussen
Esri Contributor

Good morning. There is a way for you to use Arcade AND still allow editing for the field, if needed. You will need two fields for this, one will be your date field, which I'm assuming already exists. The second will be a modify date field, this will be the field you will use to made the date field editable. Then follow the steps below:

1. Add this Arcade expression in the Calculated Expression section for your date field, this will set the date to today's date automatically when collecting a new record and leave the original inspection date if the record is being edited (be sure to change the InspectionDate to the name of your date field.

if ($editcontext.editType == 'INSERT'){
  return Today()
}
else{
  return $originalFeature.InspectionDate
}

2. Make the modify date field (mentioned above) into a switch field with yes/no switch values and no as the default value. 

3. Select the date field and add a new Arcade expression in the editable logic section (make sure to use the name of your modify date field here):

DomainName($feature, "Modify_Date") == "Yes"

Now if you toggle the switch to yes, you will be able to edit your date field. 

If you would like to see a demo of this, you can watch the Maximize Field Efficiency with ArcGIS Field Maps webinar.

 

 

 

0 Kudos