Dashboards & Visualizations

Javascript not working

GrishmaG
New Member

I'm trying to enable submit button only when there are 7 digits entered in the textbox.
below is the javascript I'm trying it with

require([
"jquery",
"splunkjs/mvc/simplexml/ready!"
], function($,TableView, mvc, DashboardController){
var checkAndSetEvents = function() {
if($("#user_input").length) {
$("#user_input").change(function(event){
if(event.target.value && event.target.value.length > 7) {
$(".btn.btn-primary.submit").removeAttr("disabled");
} else {
$(".btn.btn-primary.submit").attr("disabled", "disabled");
}
});
} else {
setTimeout(checkAndSetEvents, 500);
}
}
checkAndSetEvents();

});

0 Karma

GrishmaG
New Member

This is the dashboard

"""

User Dashboard

<input id="user_input" type="text" token="user">
  <label>Enter User Bank ID</label>
</input>

"""

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...