Dynamic add textbox options for list with variable item counts

07-14-2022 07:23 AM
Status: Open
Labels (3)
Occasional Contributor II

This idea originated from a survey we're building to collect recipes from the community. Having them use a multiline textbox and instructing them to put each ingredient/instruction on a newline works okay, but it'd be really nice to have a more interactive option where they can add each ingredient in its own textbox (bonus if there could be an associated dropdown or textbox to specify the measurement units). This way people could add as many ingredients or instructions as their recipe requires.

On the backend, I think we'd want all of the data entered into this question added to a single field with newlines, commas, or some other delimiter to separate each entry.

I included a very basic mockup image to further explain the idea. I could see this functionality also being useful for surveys where you want to list multiple people as team members/contacts or other situations where the user has a list of items to submit but we don't know how long that list will be for each entry.


I think this can be solved by using repeats. They don't list like you're wanting but they can be configured so duplicate ingredients couldn't be entered (unless spelling is different).



Thanks @AKitch - that got me off to a good start!

Here's the survey settings I used based on that article. For the hidden field calculation, I played around a bit and found that a <br/> tag worked both in pop-ups and experience builder for putting each entry on a new line!

XLSForm settings

Survey settings.jpg

Form entry
It's fine, but it'd be nice to be able to customize the plus button and/or change how the user interacts with it. I feel like intuitively I'd want to hit submit to submit an ingredient and then keep going to add another. 

Form entry.jpg

Pop-up (with a text content block)
Looks great, no Arcade or extra formatting needed! The <br/> tag even works when using the default field list option.


Experience Builder (textbox within a list widget)
This is ultimately where we'll use the data, so the <br/> tag working here was most important. You have more flexibility within a web map since you have access to Arcade text functions, but alas, Experience Builder doesn't have those yet, at least as far as I know.

Data - experience builder.jpg


I will say, this wasn't terrible to set up, but it'd be nice to have something more configurable/easy to stand up in the web designer too still.