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>

 

Get Updates on the Splunk Community!

Uncovering Multi-Account Fraud with Splunk Banking Analytics

Last month, I met with a Senior Fraud Analyst at a nationally recognized bank to discuss their recent success ...

Secure Your Future: A Deep Dive into the Compliance and Security Enhancements for the ...

What has been announced?  In the blog, “Preparing your Splunk Environment for OpensSSL3,”we announced the ...

New This Month in Splunk Observability Cloud - Synthetic Monitoring updates, UI ...

This month, we’re delivering several platform, infrastructure, application and digital experience monitoring ...