I'm working on a Survey123 form and trying to configure it to prevent duplicate submissions based on the Business Name field. Ideally, I’d like the form to check whether a business name has already been submitted and, if so, display a message or prevent the user from proceeding.
I’ve come across a few references to using JavaScript functions in Survey123 for this type of validation, but I haven’t found a complete working example that fits my use case.
Here’s what I’m trying to do:
User enters a Business Name in a text field.
Before submitting, the form checks if that name already exists in feature layer.
If it does, the form:
shows an error message
Following this topic. My organization also has use case to prevent duplicate submissions based on a key value.
I would look at putting a pulldata("@layer") function in the constraint field for Business name that queries the layer for the value someone is entering. Here's a link to how pulldata("@layer") works and how to set it up. It would be simpler than writing JavaScript. The 2nd link does say that pulldata works in the constraint column.
https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm