Dashboards & Visualizations

Dashboards - reset text fields value to "*" after submit

xZinou
Explorer

Hello,

I want to build a dashboard from which users can add rows to a lookup, in those rows many cells are calculated (for example an automatically generated ID for each row) and I want this to remain transparent for the user.

Users have to fill one or multiple text input fields, the fields left unchanged have to be set to * (I don't mind having * shows as an initial value in the input fields). Clicking the submit button must reset all fields again to *.

I tried adapting an existing answer about emptying the input fields but with no luck (I don't have enough Karma points to share the link).

I thank you in advance for your time and support.

Best regards.

0 Karma

vnravikumar
Champion

Hi

Check the following sample, here on click of submit button it will reset the text field to *

<form script="reset.js">
  <label>input</label>
  <fieldset submitButton="true">
    <input type="text" token="field1">
      <label>field1</label>
      <initialValue>*</initialValue>
      <default>*</default>
    </input>
    <input type="text" token="field2">
      <label>field2</label>
      <initialValue>*</initialValue>
      <default>*</default>
    </input>
  </fieldset>
</form>

javascript:

require([
    "jquery", 
    "splunkjs/mvc", 
    "splunkjs/mvc/simplexml/ready!"], function($, mvc) {
         var tokens = mvc.Components.get("default");
        $("#submit button").click(function(){
              tokens.unset("form.field1");
              tokens.unset("form.field2");
        });
    });
0 Karma

xZinou
Explorer

Hello,
Thank you for your answer.
This didn't work for me, I placed the reset.js file in the right place:
/opt/splunk/etc/apps/<appname>/appserver/static and restarted Splunk but had no luck.

0 Karma

vnravikumar
Champion

try with http://<<server-name>>:8000/en-US/_bump, any error are you getting in web browser console?

xZinou
Explorer

Hello,
Yes, indeed, I have a 404 error, hardcoding the script path doesn't help, Splunk insist on defining the base URL.
I couldn't specify the server name, SAML authentication revert me back to "splunk:8000".
Any ideas on how to resolve that (without disabling SAML for selected users) ?
Thank you.

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 ...