My use case is something similar to this
dropdown1 select country
dropdown2 select city
I should populate dropdown2 in my form only after some selection is made on dropdown1.
I guess my example pretty much explains my use case.
The workaround I have right now is to have a single dropdown with values concatenated(ie country1.city1, country1.city2 ...) which isn't pleasant if I have too many items in the dropdown. From the above example if I have 20 countries and each have 15 cities then I would end up with a dropdown containing 300 options which isn't good user experience.
I highly suggest you take a look at the UI-Examples application - they have a prime example dedicated to this subject.
That being said, here's a snippet of one of my advanced xml examples:
<!--Set up DropDown with host list-->
<module name="SearchSelectLister" layoutPanel="mainSearchControls" autoRun="True">
<param name="settingToCreate">series_setting</param>
<param name="search">| metadata type=hosts </param>
<param name="earliest">-90d@d</param>
<param name="searchFieldsToDisplay">
<list>
<param name="value">host</param>
<param name="label">host</param>
</list>
</param>
<param name="label">Team Fortress 2 Game Server: </param>
<module name="ConvertToIntention">
<param name="settingToConvert">series_setting</param>
<param name="intention">
<param name="name">stringreplace</param>
<param name="arg">
<param name="host">
<param name="fillOnEmpty">True</param>
<param name="value">$target$</param>
</param>
</param>
</param>
<!--Set up DropDown with user list for specified host-->
<module name="SearchSelectLister">
<param name="settingToCreate">series_setting</param>
<param name="applyOuterIntentionsToInternalSearch">True</param>
<param name="searchWhenChanged">True</param>
<param name="search">host="$host$" eventtype="tf2_login" | fields playername,host | dedup playername | sort playername </param>
<param name="earliest">-90d@d</param>
<param name="searchFieldsToDisplay">
<list>
<param name="value">playername</param>
<param name="label">playername</param>
</list>
</param>
<param name="label">Team Fortress 2 Player: </param>
<module name="ConvertToIntention">
<param name="settingToConvert">series_setting</param>
<param name="intention">
<param name="name">stringreplace</param>
<param name="arg">
<param name="playername">
<param name="fillOnEmpty">True</param>
<param name="value">$target$</param>
</param>
</param>
</param>
I recommend you checking out http://www.splunk.com/base/Documentation/latest/Developer/UseSwitchers as well.
For the first, dropdown1, i use a search to populate it ...I have a search for dropdown1 which gets the selection on dropdown1 as parameter
I highly suggest you take a look at the UI-Examples application - they have a prime example dedicated to this subject.
That being said, here's a snippet of one of my advanced xml examples:
<!--Set up DropDown with host list-->
<module name="SearchSelectLister" layoutPanel="mainSearchControls" autoRun="True">
<param name="settingToCreate">series_setting</param>
<param name="search">| metadata type=hosts </param>
<param name="earliest">-90d@d</param>
<param name="searchFieldsToDisplay">
<list>
<param name="value">host</param>
<param name="label">host</param>
</list>
</param>
<param name="label">Team Fortress 2 Game Server: </param>
<module name="ConvertToIntention">
<param name="settingToConvert">series_setting</param>
<param name="intention">
<param name="name">stringreplace</param>
<param name="arg">
<param name="host">
<param name="fillOnEmpty">True</param>
<param name="value">$target$</param>
</param>
</param>
</param>
<!--Set up DropDown with user list for specified host-->
<module name="SearchSelectLister">
<param name="settingToCreate">series_setting</param>
<param name="applyOuterIntentionsToInternalSearch">True</param>
<param name="searchWhenChanged">True</param>
<param name="search">host="$host$" eventtype="tf2_login" | fields playername,host | dedup playername | sort playername </param>
<param name="earliest">-90d@d</param>
<param name="searchFieldsToDisplay">
<list>
<param name="value">playername</param>
<param name="label">playername</param>
</list>
</param>
<param name="label">Team Fortress 2 Player: </param>
<module name="ConvertToIntention">
<param name="settingToConvert">series_setting</param>
<param name="intention">
<param name="name">stringreplace</param>
<param name="arg">
<param name="playername">
<param name="fillOnEmpty">True</param>
<param name="value">$target$</param>
</param>
</param>
</param>
I recommend you checking out http://www.splunk.com/base/Documentation/latest/Developer/UseSwitchers as well.
Hi Brian, Which section in the UI app is the "prime example dedicated"? I cant seem to find it anywhere.. Thanks in advance.
Thanks Brain... It works...
Where do you get the options for the dropdowns? Are those gathered by a search or are they defined statically?