Select to view content in your preferred language

How to restrict Survey Submission based on Map Data

573
7
Jump to solution
11-26-2024 05:24 AM
aam
by
Frequent Contributor

Hello,

I have a hosted feature layer used with the Survey123 app. Users click on dots on the map to open and submit a survey. However, I want to prevent surveys from being submitted for dots that are not eligible. How can I achieve this?

 

0 Kudos
1 Solution

Accepted Solutions
abureaux
MVP Frequent Contributor

Give this a shot.

EDIT: Just so we're clear, I modelled a few items off the example you sent for the sake of familiarity (since you seem to be aiming for that). The ${my_dropdown} is a placeholder though, and not something intended to be in the final product.

View solution in original post

7 Replies
abureaux
MVP Frequent Contributor

You can pull that value into S123 via URL parameters (if not doing so already), and use it in a calculate field. If you dynamically make fields Read_Only = Yes and they are required, form cannot be submitted. I do something similar in a form where I lock users without accounts from collecting from the app directly.

0 Kudos
aam
by
Frequent Contributor

I am using Experience Builder and the Survey Widget within that. Aiming for something like this.

https://experience.arcgis.com/experience/4299aff15d8a47a69a9a352aa5ce3049/page/Page/#data_s=id%3Adat...

I 've configured everything to my liking, except that I want the Survey to be non-submittable if the Road for example is "Not Eligible"

0 Kudos
abureaux
MVP Frequent Contributor

Yep, that is pretty easy. Just pull that "Not Eligible" value into a hidden field.

In this example, I the field ${launch_l_yes} is testing for the word "Link". If the field ${launch_type} = "Link, then the result is "yes". ${launch_l_yes} is used in the readonly column for a bunch of fields.

abureaux_0-1732644995131.png

The end result is that when "Link" is detected, all those fields become readonly = yes.

I've attached an example that may work for you.

0 Kudos
aam
by
Frequent Contributor

I did this but unfortunately the Survey still accepts the response and allows submission.

0 Kudos
abureaux
MVP Frequent Contributor

Give this a shot.

EDIT: Just so we're clear, I modelled a few items off the example you sent for the sake of familiarity (since you seem to be aiming for that). The ${my_dropdown} is a placeholder though, and not something intended to be in the final product.

aam
by
Frequent Contributor

ok this worked. I definitely need to look into these URL parameters, very helpful and cool at the same time.

One more question, this current setup gives the user error if the condition of eligibility is not met. Is it possible to have the Submit Button greyed-out or change the error message to something else?

aam_0-1732741907402.png

 

0 Kudos
abureaux
MVP Frequent Contributor

Greyed out, no.

There is a URL parameter that hides the button though:

Launch the web app

hide

Hides elements of the survey in the web app. The parameter can accept multiple values separated by a comma. Valid values are navbar (the bar at the top of the survey, including options to sign in, sign out, and change language), header, description, footer, submit, theme, and leaveDialog (the warning message that appears when navigating away from or closing the page). You can also use the field:fieldName parameter to hide a specific question, group, page, or repeat, by providing the name in place of fieldName. Questions in repeats cannot be hidden individually.

Example:

 
hide=header,description,footer,theme

String