Dashboards & Visualizations

selectFirstChoice not working in dynamic dropdowns after update of generating search

Muryoutaisuu
Communicator

Hi guys

I have three form inputs. The last two are dynamic dropdowns. Their values are generated with a search, in which the value from the first input is used. The dropdowns are configured to always select the first choice

<selectFirstChoice>true</selectFirstChoice>

Whenever I change the first input, the two other dynamic dropdowns are regenerated. Unfortunately the dropdown's selected choice goes empty, instead of choosing the first available value.

Has someone else experienced the same? Or can someone provide me with a workaround?
Thank you

1 Solution

rphillips_splk
Splunk Employee
Splunk Employee

You can set this for the dropdown:

<change>
    <unset token="form.dropdown"></unset>
</change>

example dashboard

<form script="simple_xml_examples:showtokens.js"> 
  <label>selectfirstchoice</label> 
  <fieldset submitButton="false" autoRun="true"> 
    <input type="dropdown" token="dropdown" searchWhenChanged="true"> 
      <!--<choice value="foo">Foo</choice>--> 
      <search> 
        <query>index=$index$ | head 200 | stats count by sourcetype</query> 
      </search> 
      <fieldForLabel>sourcetype</fieldForLabel> 
      <fieldForValue>sourcetype</fieldForValue> 
      <selectFirstChoice>true</selectFirstChoice>
    </input> 
    <input type="text" token="index" searchWhenChanged="true">
      <change>
        <unset token="form.dropdown"></unset>
      </change>
    </input> 
    <input type="time" token="field1" searchWhenChanged="true"> 
      <label></label> 
      <default> 
        <earliest>-15m</earliest> 
        <latest>now</latest> 
      </default> 
    </input> 
  </fieldset> 
  <row> 
    <panel> 
      <chart> 
        <search> 
          <query>index=_internal | timechart count</query> 
          <earliest>$field1.earliest$</earliest> 
          <latest>$field1.latest$</latest> 
        </search> 
        <option name="charting.chart">line</option> 
      </chart> 
    </panel> 
  </row> 
</form>

View solution in original post

Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...