Hi,
I'm having a problem using tokens set with JavaScript inside my XML, specifically inside input tags.
I have a dashboard with tabs and I'm using js to set a token when I move between them.
Then I use the token in my dashboard queries so they'll run only when their respective tab is active.
All work's well for most queries, but for those inside an input tag, there's a problem: splunk doesn't acknowledge the token set within the js code. it does recognize tokens set within the xml.
js code that sets the token:
var tokens = mvc.Components.getInstance("submmited");
tokens.set(tabToken, '');
dashboard xml:
<!-- Doesn't work! -->
<input>
<search>
<query>
index=$index$ sourcetype=$sourcetype$ $control_token$
</query>
</search>
</input>
<!-- Work! -->
<table>
<search>
<query>
index=$index$ sourcetype=$sourcetype$ $control_token$
</query>
</search>
</table>
This behavior repeats throughout the dashboard, so I don't think it is caused by a faulty query. (also it starts working immediately after expelling the control_token)
Any ideas on why might this occur?
thanks in advance.
Methinks you have a typo, try this:
var tokens = mvc.Components.getInstance("submitted");
tokens.set(tabToken, '');
submitted
with 2 t's and 1 m.
the typo is only in my question, not in the source. sorry about that.
anyway i don't think the problem is in a typo.
like i said, the token does work on most queries just not inside an input tag.
hi @alacercogitatus, did you find any solution or alternate to his problem, bcs I am facing the same problem.