Dashboards & Visualizations

Fill default option from dropdown with a token

DanielSp
Explorer

Hello,

I have a dropdown that I need to be filled depending other dropdown
Dropdown1:
A->X
B->Y,Z
C->W,Z

If I selected A in the first one, I need that appear already selected X in the second dropdown
If I selected B in the second one, I need that appear already selected (change from previous selection) to Y,Z in the second dropdown
If I selected C in the thirstone, I need that appear already selected (change from previous selection) to W,Z in the second dropdown

I tried with a token in the first dropdown and put the follow code in the second dropdown
<default>$token$</default>
It would work with only ONE value, but I not achieve that work for B and C that have 2 values

Could you please help me with It?
Thanks a lot

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

If I understand correctly, the second dropdown is a multi-select which you want some of the options preselected based on the choice of the first dropdown?

    <input type="dropdown" token="choice" searchWhenChanged="true">
      <label>Choice</label>
      <choice value="X">A</choice>
      <choice value="Y,Z">B</choice>
      <choice value="W,Z">C</choice>
      <change>
        <eval token="form.preselect">split($choice$,",")</eval>
      </change>
    </input>
    <input type="multiselect" token="preselect" searchWhenChanged="true">
      <label>Preselect</label>
      <choice value="W">W</choice>
      <choice value="X">X</choice>
      <choice value="Y">Y</choice>
      <choice value="Z">Z</choice>
    </input>

View solution in original post

DanielSp
Explorer

Thanks a lot¡ It works¡

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If I understand correctly, the second dropdown is a multi-select which you want some of the options preselected based on the choice of the first dropdown?

    <input type="dropdown" token="choice" searchWhenChanged="true">
      <label>Choice</label>
      <choice value="X">A</choice>
      <choice value="Y,Z">B</choice>
      <choice value="W,Z">C</choice>
      <change>
        <eval token="form.preselect">split($choice$,",")</eval>
      </change>
    </input>
    <input type="multiselect" token="preselect" searchWhenChanged="true">
      <label>Preselect</label>
      <choice value="W">W</choice>
      <choice value="X">X</choice>
      <choice value="Y">Y</choice>
      <choice value="Z">Z</choice>
    </input>
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...