How to validate user submission on a geocode service bound field

693
3
Jump to solution
04-25-2022 09:16 AM
HelenZhou
Occasional Contributor II

I am using Survey 123 connect (version 3.13.249) to create a survey. One field is a geocode service bound (see screenshot of the row in the excel for Survey 123 Connect below). This is to make sure the user select a valid address from the autocomplete list of addresses. Also, the entry is location based.

But I have found an issue with this field entry. The user is able to input any text in the field and submit the form successfully.

I am wondering - is there a way to validate the user input - making sure the address is selected from the address autocomplete list? This is public survey. From this doc https://doc.arcgis.com/en/survey123/desktop/create-surveys/pulldatajavascript.htm, JavaScript doesn't work from public survey.

Here is the screenshot of the row in the excel for Survey 123 Connect.

HelenZhou_0-1650902425020.png

HelenZhou_1-1650903292918.png

Thanks so much

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ZacharySutherby
Esri Regular Contributor

Hello @HelenZhou

You can set up a calculate question after your address question that calculates the match score based on the address question. If the match score is 100% then an address was selected from the drop down, if it's anything less then the user likely typed an answer. You can then take that calculated value and place a constraint on the address question where the match score needs to be 100%. Please see this Esri Community blog for more information. 

The calculation for the match score will be pulldata("@json",${address_question},"attributes.Score")

Thank you,
Zach

View solution in original post

0 Kudos
3 Replies
ZacharySutherby
Esri Regular Contributor

Hello @HelenZhou

You can set up a calculate question after your address question that calculates the match score based on the address question. If the match score is 100% then an address was selected from the drop down, if it's anything less then the user likely typed an answer. You can then take that calculated value and place a constraint on the address question where the match score needs to be 100%. Please see this Esri Community blog for more information. 

The calculation for the match score will be pulldata("@json",${address_question},"attributes.Score")

Thank you,
Zach
0 Kudos
HelenZhou
Occasional Contributor II

Thank you @ZacharySutherby that works! Actually I have another calculated field in my form to calculate the latitude of the selected address. I use this field != 0 as the constraint.

0 Kudos
RobertWeber
New Contributor III

What I am seeing is that the score is pretty much always 100 if using the World Geocoder.  Of course you can create a view off of that but must share it publicly for those not logged in to use it.  This is not an option for us.  Using the world geocoder basically finds a match for anything.  There has to be a better way to catch bad addresses?

0 Kudos