Conditional visibility for popup elements

04-12-2024 06:45 PM
Status: Open
Occasional Contributor III

Idea: Allow users to set conditions for displaying content elements (text, charts, images, field lists, etc.) in popups in the map viewer, similar to how we can use conditions to control the visibility of smart form groups and questions.

Use case: I have a smart form that is used to collect bird observation data using Field Maps. The form has a group of questions that are displayed for all observations, another group of bird behavior questions that it displays for live bird observations, and another group of questions that it displays for bird mortality observations. It's really easy for me to dictate which groups of questions are included on the form with a simple boolean condition like this: 

The live bird behavior questions are displayed when $feature.Alive == "Yes"
The bird mortality questions are displayed when $feature.Alive == "No"
Here's how that looks in the form configuration interface: 
When it comes to formatting my popup, I obviously don't want to display a long list of behavior values for a dead bird, and I don't want to display a list of values about cause of death for a live bird. To avoid that,  I have to either write a bunch of attribute expressions to generate content to insert in my text block, or I have to use the new Arcade block to generate the both the content and the HTML for my popup. This is doable, but time consuming. It's also a lot more challenging for my colleagues who aren't comfortable with Arcade to update/maintain.

It would be so much quicker, simpler, and more accessible if I could just create three separate text blocks, one for the fields that apply to all observations, one for bird mortalities, and one for live birds. Then it would be great if I could set a simple boolean visibility condition on the second and third text blocks so that they are only displayed when it's appropriate.

Another use case I can imagine would be to set up multiple field lists with different fields turned on and off depending on a condition. This would be another way to allow people to create tidier popups without having to write a bunch of Arcade.