Dashboards & Visualizations

Is there a way to "unset" a form parameter when a user deletes everything from the text input?

bruceclarke
Contributor

I'm creating a dashboard that has an optional text input for which the user can supply an ID. If the user supplies an ID, the dashboard switches which panels are shown or hidden (using the "depends" and "rejects" feature: http://docs.splunk.com/Documentation/Splunk/6.2.1/Viz/PanelreferenceforSimplifiedXML#panel ).

The issue that I am running into is that, after the user supplies an ID, they can no longer "unset" the text input. In other words, when you supply then delete an ID, the form parameter is set to the empty string. Splunk does NOT "unset" the form parameter. So, the wrong dashboard panels are displayed.

Is there a way to "unset" the form parameter when the user deletes everything from the text input?

Tags (4)
1 Solution

frobinson_splun
Splunk Employee
Splunk Employee

Hi @bruceclarke,
I'm a tech writer here at Splunk and I'd like to help. Have you tried using a condition element to control behavior for the panel? I think it might be possible to use a condition to check the value of the form's textbox and set or unset tokens accordingly.

See the condition element docs here:
http://docs.splunk.com/Documentation/Splunk/6.2.1/Viz/PanelreferenceforSimplifiedXML#condition_.28in...

There may also be a way to adjust the dashboard HTML. A similar question and its solution are shown in this recent Answers post:
http://answers.splunk.com/answers/247982/how-to-have-dynamic-form-inputsprompts-reset-their-1.html

Let me know if this does not help! We can continue troubleshooting.

All best,
@frobinson_splunk

View solution in original post

frobinson_splun
Splunk Employee
Splunk Employee

Hi @bruceclarke,
I'm a tech writer here at Splunk and I'd like to help. Have you tried using a condition element to control behavior for the panel? I think it might be possible to use a condition to check the value of the form's textbox and set or unset tokens accordingly.

See the condition element docs here:
http://docs.splunk.com/Documentation/Splunk/6.2.1/Viz/PanelreferenceforSimplifiedXML#condition_.28in...

There may also be a way to adjust the dashboard HTML. A similar question and its solution are shown in this recent Answers post:
http://answers.splunk.com/answers/247982/how-to-have-dynamic-form-inputsprompts-reset-their-1.html

Let me know if this does not help! We can continue troubleshooting.

All best,
@frobinson_splunk

bruceclarke
Contributor

I had tried this before, but it actually made me think of a good workaround. I decided to create a separate token and set/unset that token based on the input of the textbox. So, below, I'm not actually using the "textInputString" variable anywhere in my dashboard. Instead, I'm using the "actuallyUseThisInput" variable.

<input type="text" token="textInputString" searchWhenChanged="true">
  <label>Text Input:</label>
  <change>
    <condition value="N/A">
      <unset token="actuallyUseThisInput"></unset>
    </condition>
    <condition value="*">
      <set token="actuallyUseThisInput">$value$</set>
    </condition>
  </change>
  <default>N/A</default>
</input>

spammenot66
Contributor

This solution definitely works, but its one ugly solution. From a ui perspective, to get the user to reset all other fields, normally they would click on a button, but in this case you're asking them to type something in to clear it out?

SPLUNK please add a form button which contains the ability to change values of other tokens when user click on it. Currently as of version 6.4, the only button available for the dashboard is the "Submit" button but that only submits the main dashboard's form.

0 Karma

frobinson_splun
Splunk Employee
Splunk Employee

Excellent! Glad this works. It's an important use case for inputs.

0 Karma

DavidHourani
Super Champion

smart one 😄 good job!

0 Karma
Get Updates on the Splunk Community!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...