- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to display the input radio button option based on previous input radio button option selection?
I need help in displaying the input radio button option based on previous input radio button option selection.
If i have below options created as inputs :
<input type="Radio" token="environment">
<label >ENV<label>
<choice value="site1">s1</choice>
<choice value="site2">s2</choice>
<choice value="site3">s3</choice>
</input>
<input type="Radio" token="sub-environment">
<label >S-ENV<label>
<choice value="site1-Area1">s1A1</choice>
<choice value="site1-Area2">s1A2</choice>
<choice value="site1-Area3">s1A3</choice>
<choice value="site2-Area1">s2A1</choice>
<choice value="site2-Area2">s2A2</choice>
<choice value="site2-Area3">s2A3</choice>
<choice value="site3-Area1">s3A1</choice>
<choice value="site3-Area2">s3A2</choice>
<choice value="site3-Area3">s3A3</choice>
<choice value="*">All</choice>
</input>
I wan to dynamically display the input fields based on the first radio button option selection.
if user selects site1 radio button option automatically display radio button option labels labels s1A1,s1A2, s1A3 and All
if user selects site2 radio button option automatically display radio button option labels labels s2A1,s2A2, s2A3 and All
if user selects site3 radio button option automatically display radio button option labels labels s3A1,s3A2, s3A3 and *
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Here's an example that does what you want - note that it uses a manufactured search to create the dynamic options based on your example, which I suspect is not what you will need in practice.
In principle, you create the sub-environment options using a dynamic search that will populate the results for the sub-environment from a search using the $environment$ token from the initial selection.
<form>
<label>tst2</label>
<fieldset>
<input type="radio" token="environment">
<label>ENV</label>
<choice value="site1">s1</choice>
<choice value="site2">s2</choice>
<choice value="site3">s3</choice>
<change>
<set token="sitename">$label$</set>
<unset token="form.sub-environment"></unset>
</change>
</input>
<input type="radio" token="sub-environment">
<label>S-ENV</label>
<choice value="*">All</choice>
<fieldForLabel>site</fieldForLabel>
<fieldForValue>value</fieldForValue>
<search>
<query>| makeresults
| eval site=split("A1,A2,A3", ",")
| mvexpand site
| streamstats c
| eval site=$sitename|s$.site
| eval value=$environment|s$."-Area".c</query>
</search>
</input>
</fieldset>
<row>
<panel>
<html>
<h2>Sitename token: $sitename$</h2>
<h2>Environment token: $environment$</h2>
<h2>Sub-Environment token: $sub-environment$</h2>
</html>
</panel>
</row>
</form>
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your response. Sorry to confuse with my ask in the actual question. I could have given a better example. I am just changing my example. What if my inputs might look like this in environment and sub-environment as below
<input type="radio" token="environment">
<label>ENV</label>
<choice value="US">USA</choice>
<choice value="Asia">APAC</choice>
<choice value="UAE">UAE</choice>
</input>
<input type="radio" token="sub-environment1">
<label>S-ENV</label>
<choice value="*">All</choice>
<choice value="NewYork">NY</choice>
<choice value="LA">LA</choice>
<choice value="Washington">WT</choice>
<choice value="Delhi">DL</choice>
<choice value="Mumbai">MB</choice>
<choice value="Tokio">TK</choice>
<choice value="Dubai">DB</choice>
<choice value="Abu-Dabhi">ABD</choice>
</input>
In this case
if i select USA then it should display - NY,LA,WT and * . Rest all other sub-environment should hide.
if i select APAC it should display radio inputs as DL, MB,TK and * . Rest all other sub-environment should hide.
if i select UAE it should display DB, ABD and * . Rest all other sub-environment should hide.
Is there any why we can use tokens or depends or any other approach to hide/unhide these second(sub-environment) radio input choices
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Another way of doing this without using a lookup file is to create a search with makeresults and use that as the dynamic search (using loadjob)
<search>
<query>
| makeresults
| eval _raw="Env,Name,SubEnv,SubName
US,USA,NY,New York
US,USA,LA,LA
US,USA,WT,Washington
Asia,APAC,DL,Delhi
Asia,APAC,MB,Mumbai
Asia,APAC,TK,Tokio
UAE,UAE,DB,Dubai
UAE,UAE,ABD,Abu-Dabhi"
| multikv forceheader=1
| table Env,Name,SubEnv,SubName
</query>
<done>
<set token="subenvironment_sid">$job.sid$</set>
</done>
<earliest>-7d@h</earliest>
<latest>now</latest>
</search>
<panel>
<input type="radio" token="env" searchWhenChanged="true">
<label>env</label>
<choice value=".*">All</choice>
<default>.*</default>
<fieldForLabel>Name</fieldForLabel>
<fieldForValue>Env</fieldForValue>
<search>
<query>
| loadjob $subenvironment_sid$
| stats count by Env Name
</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
</input>
<input type="radio" token="subenv" searchWhenChanged="true">
<label>SubEnv</label>
<choice value="*">All</choice>
<initialValue>*</initialValue>
<fieldForLabel>SubName</fieldForLabel>
<fieldForValue>SubEnv</fieldForValue>
<search>
<query>
| loadjob $subenvironment_sid$
| where match(Env,$env|s$)
| stats count by SubEnv SubName
</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
</input>
<table>
<search>
<query>
| loadjob $subenvironment_sid$
</query>
<earliest>-7d@h</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">50</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
</panel>
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

The solution is to use a dynamic search in the sub-environment to populate the options for that setting, similar to my original example.
Here is another example that uses a lookup to hold the names
<form>
<label>tst1</label>
<fieldset submitButton="false">
<input type="radio" token="env" searchWhenChanged="true">
<label>env</label>
<choice value="*">All</choice>
<default>*</default>
<fieldForLabel>Name</fieldForLabel>
<fieldForValue>Env</fieldForValue>
<search>
<query>| inputlookup locs.csv
| stats count by Env Name</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
</input>
<input type="radio" token="subenv" searchWhenChanged="true">
<label>SubEnv</label>
<choice value="*">All</choice>
<initialValue>*</initialValue>
<fieldForLabel>SubName</fieldForLabel>
<fieldForValue>SubEnv</fieldForValue>
<search>
<query>| inputlookup locs.csv where Env=$env$
| stats count by SubEnv SubName</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
</input>
</fieldset>
<row>
<panel>
<table>
<search>
<query>| makeresults
| eval _raw="Env,Name,SubEnv,SubName
US,USA,NY,New York
US,USA,LA,LA
US,USA,WT,Washington
Asia,APAC,DL,Delhi
Asia,APAC,MB,Mumbai
Asia,APAC,TK,Tokio
UAE,UAE,DB,Dubai
UAE,UAE,ABD,Abu-Dabhi"
| multikv forceheader=1
| table Env,Name,SubEnv,SubName
```| outputlookup locs.csv```</query>
<earliest>-7d@h</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
</search>
<option name="count">50</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
</panel>
</row>
</form>
I have used the second search in the dashboard to make the lookup file - just copy that and use the outputlookup command to create the lookup, then the inputs will work as you want.
