Please let me know the way to clear the previous value of the token.
I created the dashboard which has two input fields.
The first input field is for "Model".
The second input field is for "Host".
Each Host has only one Model.
One Model has some Host(s).
For example, at the begining, the value of the tokens are the default value.(T-Host = "*")
At this timing the second input field shows nothing.
But the value of T-Host is still "H-1-2".
I expect the value of T-Host is "*"(default).
I can not find the way to clear the value(set the default value) of token automatically when the relative field was changed.
The bottom part (panel chart) of the source code is for confirming the value of tokens.
regards,
<form>
<fieldset autoRun="true" submitButton="false">
<input type="dropdown" searchWhenChanged="true" token="T-Model">
<populatingSearch fieldForValue="Nam-M">SEARCH-STRING-1 | table Nam-H Nam-M]</populatingSearch>
<label>Model</label>
</input>
<input type="dropdown" searchWhenChanged="true" token="T-Host">
<populatingSearch fieldForValue="Nam-H">SEARCH-STRING-2(Nam-M=$T-Model$) | table Nam-H Nam-M]</populatingSearch>
<label>Host</label>
<default>*</default>
</input>
</fieldset>
<row><panel><chart>
<title>T-Model=[$T-Model$] T-Host=[$T-Host$]</title>
<searchString>SEARCH-STRING-3</searchString>
</chart></panel></row>
</form>
Dear Ohuchi,
Did you find the solution to this problem ? I am facing the same issue. If so, could you please share the solution ?
Thanks
Sounds like you want the Host field to be set to "*" whenever the Model field changes.
You could listen to changes in the Model field and force the Host field to "*" whenever that happens. However that would also make links/drilldowns to the dashboard be unable to set Host to anything other than asterisk, as all other values would get clobbered during page load.
Should you want to take this approach anyway, you could create a JS file in appserver/static and include it with <form script="myscript.js">:
require(['splunkjs/ready!'], function(mvc) {
var tokens = mvc.Components.get('default');
tokens.on('change:T-Model', function() {
tokens.set('T-Host', '*');
});
});
Dear dfoster_splunk,
Thank you for your reply.
I created the myscriot.js file, and modified the form.
But it does not work well.
so, I am investigating now.
When I can set the default value to T_Host when T_Model changed, I will let you know.