Create a drop down list with a free text option

856
6
08-12-2021 06:05 AM
PetterKarlquist
New Contributor

Hi, i would like to create a drop down list for my tree inventory form. I would like to have 5-10 pre set values and one where the field worker can wright in free text.

0 Kudos
6 Replies
AllisonHollier
New Contributor III

I'm curious to see what answers come up from this.  My method is to add 'other' to the choices list and then the next question is a text fill based on the relevant question ${previousquestion} = 'other'.  Is there an easier way?

DougBrowning
MVP Notable Contributor

Yes this is the way if you also add the 3rd party trick. 

Have a field with the list and other as a choice.  Have a other field with the relevant like you laid out.  Have a 3rd field with a calc of if(otherisselected, use 2nd field, use list field).  Then set bind esri to null on the first two fields so that they do not submit to the service.  That way the result is all in one field in the end. 

Domains get tricky.  You could have the 3rd field also be a select one so that it builds the domains for you or add manually.  You could also use things like jr:choice to grab the value.

At least this is the best way I have seen so far.  Hope it helps.

0 Kudos
AllisonHollier
New Contributor III

Alright, Doug, I'm glad I posted.  I'm going to go look up the bind options.  I've never played with them, but I've got a humongous survey with no less than three repeats / associated tables.  Anything that will cut down the number of columns sounds like a swell idea to me.  

Petter, I hope your answer is in here somewhere! 

 

 

 

0 Kudos
abureaux
Occasional Contributor III

Maybe I am misunderstanding, but I think adding an 'other' field should already have that functionality?

I found a Blog post that describes what I do: https://community.esri.com/t5/arcgis-survey123-blog/another-other-in-survey123/ba-p/895406

Adding the "other" option (see below) will automatically add that text question to your select_one question... at least in the feature report. I believe they are still stored in separate fields in the FGDB. If you are looking to have everything stored in a single entry in the database, then I believe DougBrowning's approach is the simplest.

Basically:

typenameRelevant
select_one my_listquestion_name 
textquestion_name_otherselected(${question_name}='other')
DougBrowning
MVP Notable Contributor

You are showing it manually but you can add or_other to your select one.  But all it does is create a second field for you with _other at the end.  It actually does not mention that in the help (see below).

But then you have your data split into two fields making analysis later much harder.  The 3rd field trick I think is what most people are expecting to happen.  This is also handy for existing feature services that have no _other field.

Specify other

For multiple choice questions, surveys often include the option to choose other when an answer choice is not listed. Then the respondent is usually asked to specify the other option. You can do this in XLSForm by including or_other after the answer choice list name in the survey worksheet. The choices worksheet remains the same. See the following:

DougBrowning_1-1628868796993.png

0 Kudos
abureaux
Occasional Contributor III

Right. The or_other option is a good option.

I prefer the manual method I described above though because I am super OCD and or_other doesn't let you format the other question, so the text size difference is really annoying (this is a me problem).

Would be amazing if esri automatically appended 'other' data to the database field like what happens in the feature report, but your idea is a really good stand-in for that. I'll probably implement it in a couple of my surveys.