I have solved this problem, albeit in a less diserable manner:
First of all, I had to use to a hidden (by CSS) textinput field that created the correct token to be used in the search.
Second, by using the Splunk JS Stack and the getInstance function I was able to retrieve and set the token value to the value contained in the Django tag. Setting this allows the search to execute as it should by using the token in the search string.
Example:
Text field:
<div class="input input-text splunk-textfield" id="field1">
{% textinput id="foo"
valueField="foo"
disabled="true"
value="$foo$"|token_safe
%}
</div>
The CSS class "splunk-textfield" is a custom one which is set as hidden.
JS Block:
<script>
var deps= [
"splunkjs/ready!",
"splunkjs/mvc/textinputview",
"splunkjs/mvc/timerangeview",
"splunkjs/mvc/searchmanager",
];
require(deps, function(mvc){
jQuery(document).ready(function(){
$("form").submit(function() {
alert($('#field1').attr());
});
});
var tokens = mvc.Components.getInstance("default");
tokens.set("foo", "{{foo}}");
});
</script>
Search manager:
{% searchmanager id="base_search"
search='sourcetype=somelog AND value=$foo$'|token_safe
earliest_time="$earliestval$"|token_safe
autostart="false"
latest_time="$latestval$"|token_safe
cancelOnUnload="true"
%}
... View more