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
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>