Splunk Search

unset the inputput dropdown to default

smanojkumar
Contributor

Hello Splunkers,

   I have created a input dropdown where i need to reset all input drodpdown irrespective of the selections made to the default value of the fields.
   Here i can chnage the values that were passed to the search but I weren't unable to change the values that were present in input dropdown.

<input type="radio" token="field3" searchWhenChanged="true">
<label>Condition_1</label>
<choice value="=">Contains</choice>
<choice value="!=">Does Not Contain</choice>
<default>=</default>
<initialValue>=</initialValue>
</input>
<input type="text" token="search" searchWhenChanged="true">
<label>All Fields Search_1</label>
<default>*</default>
<initialValue>*</initialValue>
<prefix>"*</prefix>
<suffix>*"</suffix>
</input>
<input type="checkbox" token="field4">
<label>Add New Condition</label>
<choice value="1">Yes</choice>
</input>
<input type="dropdown" token="field5" searchWhenChanged="true" depends="$field4$" rejects="$reset_all_field_search$">
<label>Expression</label>
<choice value="AND">AND</choice>
<choice value="OR">OR</choice>
<default>AND</default>
<initialValue>AND</initialValue>
</input>
<input type="radio" token="field6" searchWhenChanged="true" depends="$field4$" rejects="$reset_all_field_search$">
<label>Condition_2</label>
<choice value="=">Contains</choice>
<choice value="!=">Does Not Contain</choice>
<default>=</default>
<initialValue>=</initialValue>
</input>
<input type="text" token="search2" searchWhenChanged="true" depends="$field4$" rejects="$reset_all_field_search$">
<label>All Fields Search_2</label>
<default>*</default>
<initialValue>*</initialValue>
<prefix>"*</prefix>
<suffix>*"</suffix>
</input>
<input type="checkbox" token="field14" depends="$field4$">
<label>Add New Condition</label>
<choice value="1">Yes</choice>
</input>
<input type="dropdown" token="field15" searchWhenChanged="true" depends="$field14$" rejects="$reset_all_field_search$">
<label>Expression</label>
<choice value="AND">AND</choice>
<choice value="OR">OR</choice>
<default>AND</default>
<initialValue>AND</initialValue>
</input>
<input type="radio" token="field16" searchWhenChanged="true" depends="$field14$" rejects="$reset_all_field_search$">
<label>Condition_3</label>
<choice value="=">Contains</choice>
<choice value="!=">Does Not Contain</choice>
<default>=</default>
<initialValue>=</initialValue>
</input>
<input type="text" token="search12" searchWhenChanged="true" depends="$field14$" rejects="$reset_all_field_search$">
<label>All Fields Search_3</label>
<default>*</default>
<initialValue>*</initialValue>
<prefix>"*</prefix>
<suffix>*"</suffix>
</input>
<input type="checkbox" token="reset_all_field_search" searchWhenChanged="true">
<label>Reset All field search</label>
<choice value="reset_all_field_search">Yes</choice>
<delimiter> </delimiter>
<change>
<condition value="reset_all_field_search">
<unset token="search"></unset>
<set token="search">*</set>
<unset token="search2"></unset>
<set token="search2">*</set>
<unset token="search12"></unset>
<set token="search12">*</set>
<unset token="field4"></unset>
<set token="field4">*</set>
<unset token="field5"></unset>
<set token="field5">*</set>

</condition>
</change>
</input>

please help me to fix this.

Thanks!

0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Each input has effectively two tokens, one for what the user has chosen on the form, and one for the result of the selection. Try something like this

<change>
<condition value="reset_all_field_search">
<unset token="form.search"></unset>
<set token="form.search">*</set>
<unset token="form.search2"></unset>
<set token="form.search2">*</set>
<unset token="form.search12"></unset>
<set token="form.search12">*</set>
<unset token="form.field4"></unset>
<set token="form.field4">*</set>
<unset token="form.field5"></unset>
<set token="form.field5">*</set>

</condition>

 

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Each input has effectively two tokens, one for what the user has chosen on the form, and one for the result of the selection. Try something like this

<change>
<condition value="reset_all_field_search">
<unset token="form.search"></unset>
<set token="form.search">*</set>
<unset token="form.search2"></unset>
<set token="form.search2">*</set>
<unset token="form.search12"></unset>
<set token="form.search12">*</set>
<unset token="form.field4"></unset>
<set token="form.field4">*</set>
<unset token="form.field5"></unset>
<set token="form.field5">*</set>

</condition>

 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...