@yshen Simple XML JS extension should work as the issue you have listed is unrelated to dashboard. Have you added id="multi1" for the multi-select input you have created in the UI? If so please share Simple XML snippet for multi-select as well. Also while debugging JS it is good practice to add console.log like console.log("Inside my multi-select JS script") as first executable JS line so that you can debug into issues through Browser console. In your example you are having console log inside multiselect change handler which may not execute if mulitselect with ID multi1 does not exists in SimpleXML. Also you may have to bump, refresh, restart Splunk, followed by internet Browser history cleanup depending on your Dev environment configuration for static files like JS, CSS, images to work. Following is bare-minimal code which I tried and worked (shows output in Browser Inspector Console). <form script="multiselect.js">
<label>Multiselect through JS</label>
<fieldset submitButton="false">
<input id="multi1" type="multiselect" token="multi1" searchWhenChanged="true">
<label>Multiselect 1</label>
<choice value="a">Apple</choice>
<choice value="b">Beta</choice>
<choice value="c">Charlie</choice>
</input>
</fieldset>
</form> Following is required JS but do not know its actual purpose and catch watch whole video tutorial to understand what is your use case. Just want to let you know that most Multi-Select output can be handled in Simple XML as well (following answer explains similar use case but with check-box instead of multi-select: https://community.splunk.com/t5/Dashboards-Visualizations/Can-I-hide-unhide-specific-text-boxes-using-a-single-checkbox/m-p/413895). require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
],
function ($, _, mvc) {
console.log("Inside Multiselect JS");
var multi1 = mvc.Components.get("multi1")
multi1.on("change", function () {
current_val = multi1.val()
console.log("Current Vals: " + current_val)
var first_choice_value = multi1.options.choices[0].value;
if (current_val.length > 1 && current_val.indexOf(first_choice_value) == 0) {
multi1.val(_.without(current_val, first_choice_value));
}
if (current_val.length > 1 && current_val.indexOf(first_choice_value) > 0) {
multi1.val([first_choice_value]);
}
});
});
... View more