I want to make a restriction on opening a form on survey123 untill I can detect that the one who is filling the Form is in the right location

482
1
07-09-2021 12:34 PM
omarfarag
New Contributor
 
0 Kudos
1 Reply
DougBrowning
MVP Notable Contributor

No you can never adjust the UI in 123.

What I do is calculate a static lat/long of where they are supposed to go then send that from Collector to 123. (You can also use Arcade to get the lat/long in Collector on the fly so that if a point is moved or added no need to recalc - have this code if you need it.) In 123 I calculate the distance from the sent lat/long to where the user currently is.  You can set a constraint on this so they cannot submit.  Also if your form is not too big you could hide all the fields until they are with a set distance.  One thing to be careful of is if they are in a canyon or something and cannot get a good fix they are stuck.  Also if the GPS will not spool up, like when using battery saver or airplane mode or have location turned off they will get stuck also.

The formula in 123 - the Design ones are the static lat/long and the other pulls from the GPS question using pulldata.  Make sure your static lat/longs are WGS84.

round(acos(sin(${Northing} * pi() div 180)*sin(${DesignLat} * pi() div 180) + cos(${Northing} * pi() div 180)*cos(${DesignLat} * pi() div 180)*cos((${DesignLong} * pi() div 180)-(${Easting} * pi() div 180))) * 6371000,2)

 

Hope that helps