Here is the JS. I gave the input id="user_name". require([
"splunkjs/mvc",
"splunkjs/mvc/simplexml/ready!"
], function (mvc) {
// get default token model
var tokens = mvc.Components.getInstance("default");
var user_name = document.getElementById("user_name");
// Set required style if init value is undefined to channel
if (tokens.get("user_name") === 'Enter a User') {
user_name.classList.add("required");
}
// Dropdown change on channel
tokens.on("change:user_name", function (model, value) {
if (value === 'Enter a User') {
user_name.classList.add("required");
} else {
user_name.classList.remove("required");
}
});
}); Here is the CSS again just to capture it all in the same reply. .required button{
border: 2px solid #f6685e !important;
} I use this code (more or less) on other dashboards to perform the same "required" function on other inputs like drop downs and it works by creating a red outline around the drop down until a choice is made.
... View more