<form>
<fieldset submitButton="false">
<input type="time" token="tok_time">
<label>Time</label>
<default>
<earliest>-24h@h</earliest>
<latest>now</latest>
</default>
</input>
<input id="Reset" type="link" token="resetTokens" searchWhenChanged="true">
<label></label>
<choice value="Reset">Reset</choice>
<change>
<condition value="Reset">
<unset token="tok_Time"></unset>
<unset token="form.tok_Time"></unset>
<set token="resetTokens">yes</set>
<set token="form.resetTokens">yes</set>
</condition>
</change>
</input>
<html depends="$alwaysHideCSSOverride$">
<style>
div[id^="Reset"] button{
width: 180px !important;
background: rgb(192,192,192,1);
padding: 10px;
border-radius: 10px;
color: Blue !important;
}
</style>
</html>
</fieldset>
</form>
You were not using the right tokens in the change element (also you had case issue tok_TIme vs tok_time). Here's your example - working (I added a panel to show the token values)
<form>
<fieldset submitButton="false">
<input type="time" token="tok_time">
<label>Time</label>
<default>
<earliest>-24h@h</earliest>
<latest>now</latest>
</default>
</input>
<input id="Reset" type="link" token="resetTokens" searchWhenChanged="true">
<label></label>
<choice value="Reset">Reset</choice>
<change>
<set token="tok_time.earliest">-24h@h</set>
<set token="tok_time.latest">now</set>
<set token="form.tok_time.earliest">-24h@h</set>
<set token="form.tok_time.latest">now</set>
<unset token="form.resetTokens"></unset>
</change>
</input>
<html depends="$alwaysHideCSSOverride$">
<style>
div[id^="Reset"] button{
width: 180px !important;
background: rgb(192,192,192,1);
padding: 10px;
border-radius: 10px;
color: Blue !important;
}
</style>
</html>
</fieldset>
<row>
<panel>
<html>
<h1>E:$tok_time.earliest$</h1>
<h1>L:$tok_time.latest$</h1>
<h1>R:$form.resetTokens$</h1>
</html>
</panel>
</row>
</form>
You were not using the right tokens in the change element (also you had case issue tok_TIme vs tok_time). Here's your example - working (I added a panel to show the token values)
<form>
<fieldset submitButton="false">
<input type="time" token="tok_time">
<label>Time</label>
<default>
<earliest>-24h@h</earliest>
<latest>now</latest>
</default>
</input>
<input id="Reset" type="link" token="resetTokens" searchWhenChanged="true">
<label></label>
<choice value="Reset">Reset</choice>
<change>
<set token="tok_time.earliest">-24h@h</set>
<set token="tok_time.latest">now</set>
<set token="form.tok_time.earliest">-24h@h</set>
<set token="form.tok_time.latest">now</set>
<unset token="form.resetTokens"></unset>
</change>
</input>
<html depends="$alwaysHideCSSOverride$">
<style>
div[id^="Reset"] button{
width: 180px !important;
background: rgb(192,192,192,1);
padding: 10px;
border-radius: 10px;
color: Blue !important;
}
</style>
</html>
</fieldset>
<row>
<panel>
<html>
<h1>E:$tok_time.earliest$</h1>
<h1>L:$tok_time.latest$</h1>
<h1>R:$form.resetTokens$</h1>
</html>
</panel>
</row>
</form>
the below one is not working, if you add one more token of other filter , it is not working .
Hi @supraja,
good for you, see next time!
Ciao and happy splunking
Giuseppe
P.S.: Karma Points are appreciated by all the contributors 😉
Hi @supraja,
I'm not sure that's possible to add an html button in the input section, so I used this solution that's running in my dashboards:
<input type="radio" token="resetTokens" searchWhenChanged="true">
<label></label>
<choice value="reset">Reset Inputs</choice>
<choice value="retain">Retain</choice>
<default>reset</default>
<change>
<condition value="reset">
<unset token="token1"></unset>
<unset token="timestamp"></unset>
<set token="resetTokens">retain</set>
</condition>
</change>
</input>
Ciao.
Giuseppe