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!

Labels (1)
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>

 

Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...