Auto select value in dropdown if only one value is present?

382
3
Jump to solution
02-22-2021 10:06 PM
ejrcarson
New Contributor II

Hi,

Is there an easy solution in the form, to auto select a value if there is only one value present?

We have several linked cascading drop downs, sometimes only one value would be present in a drop down. The user currently has select that value.

Is there an easy solution to auto select the single present value?

Regards,

Elliott 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Philip-Wilson
Esri Notable Contributor

Hi @LMedeirosUI,

Unfortunately this is still not possible with a select one or select multiple question, or autocomplete appearance. The user will still need to select the only one option if the filter causes there to be only one available choice. As mentioned above, the only way to auto select a value is to use a calculation, but then you would need to know what it is.

Thinking of other ways this may be able to work now, would be to see if you can use a dynamic choice filter or the search() appearance to populate a calculation that can be used to populate the select one, but not sure if this would work without trying to set it up and test it out.

Regards,

Phil.

View solution in original post

0 Kudos
3 Replies
Philip-Wilson
Esri Notable Contributor

Hi @ejrcarson,

There is currently no "out of the box" way to autoselect a value from a select one question if there is only one choice available via cascading selects. 

There may be a way you can configure your calculations to set the choice as a default if you know based on the previous answers what the choice list would be. Bascially you need to know the value so you can then set it in the calculation. Depending on how you survey works and the question types and answers, not sure if this would be possible.

If you are able to share your survey XLSForm xlsx file, we can take a look to see if any workarounds.

Regards,

Phil.

0 Kudos
LMedeirosUI
New Contributor II

I have the same question - sometimes there are multiple answers, sometimes there's only one and it would save time if (when there's only one option) it is autoselected.

I have attached my form. For the example of this, if you select Lower Granite as the site and Release as the Fish Status you can see that there is only one option in the "Fish To" field. Any way to have it be automatically selected? I can see how this may be difficult as it requires the coding to "know" (count) how many options there are rather than just pulling the right options, but figured I'd ask.

Thanks,

Lea

0 Kudos
Philip-Wilson
Esri Notable Contributor

Hi @LMedeirosUI,

Unfortunately this is still not possible with a select one or select multiple question, or autocomplete appearance. The user will still need to select the only one option if the filter causes there to be only one available choice. As mentioned above, the only way to auto select a value is to use a calculation, but then you would need to know what it is.

Thinking of other ways this may be able to work now, would be to see if you can use a dynamic choice filter or the search() appearance to populate a calculation that can be used to populate the select one, but not sure if this would work without trying to set it up and test it out.

Regards,

Phil.

0 Kudos