Developing Dashboards, Views, and Apps for Splunk Web

 


How to add radio buttons

This documentation does not apply to the most recent version of Splunk. Click here for the latest version.

How to add radio buttons

Create a form search with dynamically populated radio buttons. You can specify a search to autopopulate radio button choices. Form search users can use the radio buttons to drive their search results.

Start your radio button form

Take the form search you've already created:

<form>
 <label>Username</label>
 <searchTemplate>sourcetype=logins $username$</searchTemplate>  
 <fieldset>
  <input type="text" token="username" />
 </fieldset>
    
 <row>
  <event>
    <option name="count">100</option>
   </event>
  </row>
</form>

Now, change the <input type="text"> tag to radio and add a populatingSearch to generate the options for the radio buttons:

<input type="radio" token="username">
   <label>Select Name</label>
   <populatingSearch fieldForValue="suser" fieldForLabel="suser"><![CDATA[sourcetype=p4change | rex "user=(?<suser>\w+)@"
      | stats count by suser]]></populatingSearch>
</input>

The end result is:

<input type="radio" token="username">
   <label>Select Name</label>
   <populatingSearch fieldForValue="suser" fieldForLabel="suser"><![CDATA[sourcetype=p4change | rex "user=(?<suser>\w+)@"
      | stats count by suser]]></populatingSearch>
   <default>nagrin</default>
   <choice value="*">Any</choice>
</input>

  <row>
   <table>
    <title>Users</title>
     <option name="showPager">true</option>
    </table>
  </row>

Configuration options

There are more configuration options you can set on <code<input type=radio></code>. For example, you can add a label to appear next to the radio buttons, or specify a search to populate the radio buttons, etc. None of these options are required, but they do make the radio buttons more useful.

Here are all your options for configuration:

This documentation applies to the following versions of Splunk: 4.1 , 4.1.1 , 4.1.2 , 4.1.3 , 4.1.4 , 4.1.5 , 4.1.6 , 4.1.7 , 4.1.8 View the Article History for its revisions.


You must be logged into splunk.com in order to post comments. Log in now.

Was this documentation topic helpful?

If you'd like to hear back from us, please provide your email address:

We'd love to hear what you think about this topic or the documentation as a whole. Feedback you enter here will be delivered to the documentation team.

Feedback submitted, thanks!