I have a public survey in which I want the answers to be only within a certain area (Douro Valley, Portugal). How can I limit survey submission if the requested location is within this zone? Thanks
Take a look at pulldata("@layer"...)
If you have a feature layer that corresponds to the zone, you can add a constraint to your form. Create a read-only field in your form, and use pulldata("@layer") to retrieve the name or ID of the intersected zone. If it does not match the attribute of the Douro Valley zone, you can use a constraint to block the form from submitting.
You can set the read-only field to a "null" type, too, and not waste space storing a useless field.
We do something similar with a form of ours, where submissions are expected to fall in certain areas, and the form will not accept a submission where the point falls outside of the features we specify in our constraint.
Or the old poor mans way. Grad the lat long and but a constraint on that. Not perfect but it works ok.
Just tossing this out there, but true geographic location and what S123 (or any GPS app) reports can be two different things. Just don't expect any solution to be 100% accurate since you could end up filtering out legitimate submissions due to users being in the "wrong" location.
If you are set on this behaviour though, jcarlson and DougBrowning have given two fantastic solutions.