Dashboards & Visualizations

Unset token after click

bharathkumarnec
Contributor

HI Everyone,

I am using below HTML in my xml dashboard:

I would like to unset a token in a dashboard if i click on the above button.

please provide your inputs!

BK

stevevg
Engager
require([
     'underscore',
     'jquery',
     'splunkjs/mvc',
     'splunkjs/mvc/tableview',
     'splunkjs/mvc/simpleform/formutils',
     'splunkjs/mvc/simplexml/ready!'
 ], function(_, $, mvc, TableView, FormUtils) {

var defaultTokenModelun = mvc.Components.getInstance('default', {create: true});
var submittedTokenModelun = mvc.Components.getInstance('submitted', {create: true});

function unsetToken(name) {
    defaultTokenModelun.unset(name);
    submittedTokenModelun.unset(name);
}

$(document).on("click", "#YourPictureId", function() {
        unsetToken("show_errors_dnd")
});
});

DalJeanis
Legend

Please make sure to mark your code with the code button (101 010) or by putting at least 4 spaces on the front of each line of the block of code, so the system will not read the code as HTML and treat it accordingly.

0 Karma

niketn
Legend

@bharathkumarnec, can you add your current Simple XML code for above HTML element? Also what is the token that needs to be unset on button click?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...