Try removing the Bootstrip div elements wrapping your submit button, replacing with a plain div , and sourcing your JavaScript from a .js file -- I was using
<div class="control-group">
<div class="controls">
<input id="submit_button" type="button" value="Click" onclick="alert('Test')" />
</div>
</div>
and replaced it with
dashboard.xml
<input id="submit_button" type="button" value="Click"/>
dashboard.js
require([ "jquery", "splunkjs/mvc/simplexml/ready!"],
function($){
$("#submit_button").on("click", function (){
alert("Test");
});
});
I'm not sure why SimpleXML chomps the onclick, but this workaround helped.
Source: https://answers.splunk.com/answers/378289/calling-java-script-from-dashboard.html
... View more