Embedded survey with dynamic mode?

275
1
03-24-2023 11:17 AM
Labels (1)
DavidFlack
New Contributor III

I have built a dashboard and been able to embed Survey123 web forms and use them to add records or edit existing records by using the URL parameter  "mode=Edit".  However, that precludes me from using that form for creating new records.

It don't see any way to dynamically change the use of the form between add and edit modes?  Is there any possible workaround like adding the feature first and immediately opening the S123 form for instance?

Dave 

0 Kudos
1 Reply
jcarlson
MVP Esteemed Contributor

The easy way is to have a second embed that lacks the "mode=Edit" parameter and stacking it under the edit form. Alternatively, have a "collect new entry" link under the edit form, and just have it open in a new tab. It would be awesome if the "no data" message could be a separate embed URL, but no such luck.

A needlessly complicated manner of accomplishing this would be to create a Data Expression and to build a FeatureSet. You could have a string field that holds "&mode=Edit&globalId=<the_globalid>". Then create a single placeholder feature in which this field is null, then append the rest of the features to it.

Once you have that, you could link it to the embed, with the URL "your-survey-url/{new_string_field}". For the placeholder, this will be null, resulting in a new feature form. For the others, it will populate with the editing parameters.

- Josh Carlson
Kendall County GIS
0 Kudos